System Atlas
the atlas
NET · Networking7 minApplied

Can a web server push real-time updates?

Four ways to move fresh data from server to browser, from crude polling to a live socket.

the gist

HTTP is request-response: the client asks, the server answers, and the server has no built-in way to speak first. To fake or achieve real-time updates you climb a ladder — short polling asks on a timer, long polling holds the request open, Server-Sent Events streams one-way over a single connection, and WebSocket upgrades to a full-duplex channel. Each step cuts latency and overhead at the cost of complexity.

ANALOGY // Short polling is calling the shop every five minutes to ask if your order is ready; long polling is calling and staying on hold until it is; SSE is the shop putting you on a one-way loudspeaker of announcements; WebSocket is a two-way walkie-talkie you both keep open.
living diagram01 / 05
Short pollingtimer requests · one-way · high overhead
Long pollingheld request · one-way · near-instant
Server-Sent Eventsstreamed · server→client · auto-reconnect
WebSocketfull-duplex · two-way · lowest latency
Four ways to get real-time data past HTTP's request-response limit.
01

The problem: HTTP can't push

HTTP is fundamentally request-response — the client speaks first and the server can only answer what it was asked. Nothing in the base protocol lets a server say 'hey, something changed' on its own. Every real-time technique is a way to work around, or upgrade past, that one limitation.

02

Short polling

The client repeatedly asks 'anything new?' on a fixed timer, say every few seconds. It's trivial to build on plain HTTP and works everywhere, but most requests come back empty, wasting bandwidth and server work, and any update waits up to a full interval before it's seen. Latency and overhead are both poor, which is why it's the baseline, not the goal.

03

Long polling

The client sends a request and the server deliberately holds it open, not responding until it actually has data (or a timeout fires). The moment something happens the response returns and the client immediately reconnects. This slashes empty round-trips and delivers updates almost instantly, at the cost of many long-lived connections and fiddlier server handling.

04

Server-Sent Events (SSE)

SSE opens one long-lived HTTP connection over which the server streams a sequence of text events, one-way, server to client. The browser's EventSource API handles parsing and automatic reconnection for you. It's lightweight and ideal for feeds — stock tickers, notifications, live scores — but it can't send data back up the same channel.

05

WebSocket

A WebSocket starts as an HTTP request that 'upgrades' the connection into a persistent, full-duplex TCP channel where both sides send messages at any time with tiny per-message overhead. It's the lowest-latency, most flexible option and the right tool for chat, multiplayer games and collaborative editing. The price is a separate protocol, its own connection lifecycle, and more moving parts to operate.

the full picture
01

Why 'can a server push?' is a real question

The web runs on HTTP, and HTTP has a deep asymmetry baked in: the client always speaks first. A browser opens a connection, sends a request, and the server sends back exactly one response. The server cannot, in the base protocol, decide on its own to send you something — it has no way to say "the price just changed" or "a new message arrived" unless you asked. For a document-fetching web this was fine. For chat apps, live dashboards, multiplayer games, collaborative editors, stock tickers and notifications, it is a fundamental obstacle.

So "can a web server push real-time updates?" is genuinely a question, and the answer is "not natively, but here are four escalating techniques that get you there." They form a ladder from crude to elegant: short polling, long polling, Server-Sent Events, and WebSocket. Moving up the ladder generally reduces latency and wasted overhead while increasing implementation and operational complexity. Knowing where each one sits — and when the cheaper option is actually the right call — is the real skill.

02

Short polling — ask again and again

The simplest workaround is to just keep asking. The client sets a timer and every few seconds fires a normal HTTP request: "anything new?" The server answers with whatever it has, usually nothing, and the cycle repeats. This is short polling, and its great virtue is that it needs nothing special — plain HTTP, works through every proxy and firewall, trivial to reason about.

Its vices are latency and waste. If you poll every five seconds, an update that lands one second after a poll waits four more seconds to be seen, so your worst-case latency is the whole interval. And the overwhelming majority of requests return empty, each one still paying the full cost of a request: connection handling, headers, authentication, a server round-trip. Under load this is thousands of pointless calls per second. You can tune the interval — shorter cuts latency but multiplies waste, longer does the reverse — but you can never win both. Short polling is the honest baseline: acceptable when updates are rare and instant delivery does not matter, such as a "check for a new app version" ping.

03

Long polling — hold the line

Long polling keeps the request-response shape but flips who waits. The client sends a request, and instead of answering immediately, the server holds the connection open and does not respond until it actually has data to deliver (or a safety timeout, often 30 seconds, fires). As soon as an event occurs, the server responds, the client processes it, and then instantly opens a new long-poll request to wait for the next one.

The payoff is large: updates arrive within milliseconds of happening rather than up to a full interval later, and the stream of empty responses mostly disappears because the server only replies when there is something to say. It is still ordinary HTTP, so it works almost everywhere, which is why it powered the first generation of "live" web apps. The costs are that the server must hold many connections open simultaneously (each waiting client ties up a connection and some memory), and the logic — parking requests, resuming them, handling timeouts and reconnection cleanly — is noticeably more involved than short polling. It is a strong middle option, but there is a hidden inefficiency: every single message still incurs a fresh HTTP request/response with full headers.

04

Server-Sent Events and WebSocket — real streaming

The top two techniques stop faking it and keep a connection genuinely open.

Server-Sent Events (SSE) opens one long-lived HTTP connection and lets the server stream a sequence of text messages down it, one after another, for as long as the connection lives. It is one-directional — server to client only — and built into browsers via the EventSource API, which parses the event stream and, crucially, reconnects automatically if the connection drops, even resuming from the last event ID. Because it rides on plain HTTP it plays nicely with existing infrastructure. SSE is the sweet spot for one-way feeds: live scores, notifications, log tails, price tickers, an AI response streaming token by token.

WebSocket goes furthest. It begins life as a normal HTTP request carrying an Upgrade: websocket header; if the server agrees, that same TCP connection is "upgraded" and from then on speaks the WebSocket protocol instead of HTTP. The result is a persistent, full-duplex channel: both client and server can send messages at any moment, independently, with only a few bytes of framing overhead per message rather than a full set of HTTP headers. That makes it the lowest-latency, highest-throughput option and the only one that is truly bidirectional. It is what you reach for when the client and server are in constant two-way conversation — chat, multiplayer games, collaborative documents, live trading.

05

Choosing, and the operational reality

A quick decision guide:

  • Rare updates, simplicity wins? Short polling. Do not add a socket to check for something twice an hour.
  • Frequent one-way updates, must stay on HTTP? Long polling — the compatible fallback that still feels instant.
  • A stream of server→client events and nothing to send back? SSE — lighter than WebSocket, auto-reconnecting, HTTP-native.
  • Genuine two-way, interactive, low-latency traffic? WebSocket.

The trade-offs are consistent: as you climb, latency and per-message overhead fall while complexity rises. The persistent-connection options also change your operational picture. Holding tens of thousands of open connections stresses servers and load balancers differently than short bursts do; you must plan for connection limits, heartbeats to detect dead peers, back-pressure when a client is slow, and graceful reconnection. Proxies and older networks sometimes interfere with long-lived connections, so robust apps layer in fallbacks — many real systems try WebSocket first and quietly drop to long polling when it fails. And none of these change that the browser still initiated everything; even WebSocket starts as an HTTP handshake. The lesson is that "server push" on the web is always a technique built on top of a client-initiated connection, and picking the right one is about matching the connection's shape to how your data actually flows.

what to remember
01

Plain HTTP can't push: the server only replies to requests, so real-time needs a workaround.

02

Short polling requests on a fixed timer — simple, but wastes calls and adds up-to-interval latency.

03

Long polling holds the request open until data exists, then reconnects — near-instant, fewer empty calls.

04

Server-Sent Events (SSE) streams one-way server→client over one long-lived HTTP connection, with auto-reconnect.

05

WebSocket upgrades the connection to full-duplex, low-overhead, bidirectional messaging — best for chat and games.

06

Pick by need: polling for rare updates, SSE for one-way feeds, WebSocket for interactive two-way traffic.

check yourself

Quick quiz

Q1

What is the core reason plain HTTP can't push updates on its own?

Q2

You need a one-way live feed of notifications with automatic reconnection and minimal fuss. Which fits best?

follow the thread