Realtime APIs: WebSockets vs SSE vs Polling
How to push live updates: the honest tradeoffs between polling, Server-Sent Events, and WebSockets, and which to reach for when.
- Why HTTP Can't Push Plain HTTP is a pull: the client asks, the server answers, the line hangs up. Realtime means the server needs to start the conversation — and the three patterns (polling, SSE, WebSockets) are three ways to make that possible.
- The Three Patterns in Practice Hands-on: long-polling that holds the request open, a real SSE stream the browser reconnects for free, and a full-duplex WebSocket — plus the comparison table that tells you which to grab.
- When It Breaks at Scale One server is easy; many servers is the hard part. Sticky sessions, the fan-out problem, a pub/sub backplane, and the honest case for reaching for the simplest pattern that fits.