Live messaging

How live messages work

One conversation. Three ways to deliver it.

Packets & network delay →

Conversation time0 s/ 10 s
1requests / handshakes
—last update’s app wait
Story begins · 0 s

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

0
shop.example · order chat
  1. No messages yet.
Polling

Repeated HTTP requests

Browser asks → server answers

Shop server

Incoming from your browser

0
Message service · simulated
  1. No browser messages received yet.
Outgoing update queue0

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
  1. 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.

Polling asks; SSE pushes; WebSocket sends both ways.
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.