How live messages work
One conversation. Three ways to deliver it.
The simulator could not load. Keep assets/network-model.js alongside this guide’s other assets. The explanations below remain readable.
Open the conversation.
Press Play or Next event. Quiet seconds are skipped; compare when the shop’s news becomes visible.
Your browser
Conversation · latest 4 messages
- No messages yet.
Repeated HTTP requests
Browser asks → server answers
Shop server
Incoming from your browser
- No browser messages received yet.
No updates waiting to be sent.
Try your own messages
Send to pause and insert now. Next event continues; Restart clears additions.
Inspect the protocol log
- GET /updates → no new messages. Next poll at 5 s.
Latest eight events. All earlier events remain part of the simulation.
0 s wait means no app waiting—not zero network latency. This story models messaging patterns, not packet transit.
How the patterns work & model notes
Polling asks every five seconds. Updates wait for the next request.
Polling asks for news; SSE pushes server events, with browser replies using separate HTTP requests; WebSocket lets both sides send on one channel. Messages are not individual packets.
The shop creates news at 1 s. Polling receives it at 5 s: four seconds of application waiting. SSE and WebSocket receive it at 1 s in this model because transit and processing are omitted. Switching patterns preserves the same moment.
Playback advances one meaningful event per beat, skipping quiet seconds. The same checkpoints are used for every pattern: messages at 1, 2, 6, and 7 s, plus polling times at 5 and 10 s. Polling times remain visible when comparing an open channel. Tokens show direction, not speed. Transit and processing are omitted to isolate app waiting.
Classic WebSocket uses TCP: missing earlier bytes can delay later messages. WebSocket adds framing; wss:// adds TLS protection.
A separate HTTP request need not create a new physical connection. All patterns need connection management; reconnecting does not guarantee replay. Long polling—holding a request until news or timeout—is another option.