Real-Time UI

Polling, long polling, SSE and WebSocket compared by what they cost — plus reconnect, ordering, duplicate delivery and the resynchronisation nobody prototypes.

Choosing a Real-Time Transport

Polling, long polling, SSE and WebSocket compared by direction, connection cost, infrastructure friction, reconnection, framing and what the browser already does for you.

Q · Which transport does this feature actually need, and what does each one cost me after the prototype works?
Server-Sent Events

One-way, text, and reconnecting by default: what `EventSource` does for you, how `Last-Event-ID` closes a gap, and the per-origin connection limit that only bites in the fifth tab.

Q · When is a one-way text stream with reconnection already built in the right answer, and what is the trap that only appears in production?
WebSockets in the UI

Bidirectional, framed, and no longer HTTP — which means heartbeats, reconnection, backoff, auth on connect, message schema and versioning are now yours.

Q · What exactly did I take on when I replaced request/response with an open connection?
Reconnect and Backoff

Exponential backoff with jitter, why a server restart without jitter produces a synchronised stampede, and how to say "reconnecting" to a user without saying it a hundred times.

Q · The connection dropped — how soon should I try again, and what happens when every client asks that question at the same instant?
Ordering and Duplicate Delivery

At-least-once is the normal case: events arrive twice, arrive late, and arrive in an order nobody promised. The UI's job is to be idempotent per event.

Q · If the same event can arrive twice and two events can arrive backwards, what does my reducer have to look like?
Resynchronisation After a Gap

The disconnect left a hole. Replay from a cursor or refetch a snapshot — but never resume as if nothing was missed, which is what everybody ships first.

Q · The connection is back. What happened while it was gone, and how do I get this client to the truth?