Polling vs WebSockets vs SSE for Live Maps: What We Measured, What We Shipped
For a live map, the right answer is rarely one transport: poll the slow layers, stream the fast ones with Server-Sent Events (SSE), and reserve WebSockets for when the client truly needs to talk back. That hybrid is what we shipped — and the measurements below are why no single option won.
I learned this building WorldEye, a real-time globe with 74,229 live public cameras alongside flights, satellites, weather, earthquakes, fires and traffic. Browsing is free — you can explore the globe without an account; unlimited camera opens require an upgrade. Every layer on that globe updates at a different natural cadence, and forcing them all through one pipe was our first mistake.
Start with the cadence, not the protocol
Before comparing transports, write down how often each dataset actually changes:
| Layer | Source cadence | Staleness users notice |
|---|---|---|
| Flights | New positions every ~5–10 s | After ~15 s |
| Satellites | Computed continuously, TLEs update daily | After ~5 s (client can interpolate) |
| Weather radar | New tiles every ~5–10 min | After ~10 min |
| Earthquakes | USGS feed updates every ~1 min | After ~5 min |
| Fires | FIRMS/EONET detections, minutes to hours | After ~15 min |
| Cameras | Snapshot on open; streams are per-camera | On click, not on a timer |
Two lessons fall out of that table. First, most "real-time" geo data is not real-time at all — radar and earthquake feeds are minute-scale no matter how fancy your transport is. Polling a 5-minute feed every 5 seconds buys you nothing except bill. Second, the fastest layers can be interpolated on the client, so the network does not need to carry every visual frame. Match the transport to the cadence, and half the argument disappears.
Option 1: Polling — boring, cacheable, and often correct
Polling is a timed fetch against a normal HTTP endpoint, ideally with ETag / If-None-Match so unchanged data costs a 304 instead of a full body.
Where it won for us: earthquakes, fires, and radar tile metadata. A 60-second poll on the earthquake layer, with conditional requests, meant most cycles transferred zero bytes — the feed had not changed. CDNs cache it, proxies understand it, and a failed request is just a skipped cycle, not a broken connection to debug.
The costs are real, though:
- Latency floor: average staleness is half your interval. A 60 s poll means data is 30 s old on average before network time.
- Wasted requests scale with users, not with change. 10,000 idle tabs polling every 10 s is ~1,000 requests/second for data that may change every minute.
- Battery and data: every poll wakes the radio on a phone, even for a
304.
Polling is the right default for any layer whose source updates slower than once a minute — but add conditional requests and jitter, or every tab will poll on the same second boundary.
Option 2: WebSockets — full duplex you probably don't need
A WebSocket is a persistent, bidirectional connection: the server pushes the moment data lands, and the client can send messages back up the same pipe.
Where it genuinely fits: collaborative cursors, chat, trading, multiplayer — anywhere the client sends as much as it receives. For a mostly read-only map, that second direction sits idle. What you pay for it does not:
- Connection state on your servers. 10,000 open sockets is 10,000 things to load-balance, drain on deploy, and reconnect after every network blip. Sticky sessions or a pub/sub fan-out layer become mandatory, not optional.
- No free HTTP caching. Every push is bespoke; the CDN cannot absorb a spike for you.
- Reconnect logic is yours. Exponential backoff, resubscription, and "what did I miss while I was gone?" reconciliation are all application code now.
We prototyped flight updates over WebSockets. Median delivery was excellent — under 300 ms from ingest to browser — but our ingest itself only received new positions every 5–10 seconds, so users saw no visible difference versus a 5-second SSE stream. We were paying connection-state costs to hide a latency that did not exist in the data.
Option 3: SSE — one-way push with HTTP's tooling
Server-Sent Events (EventSource in the browser) is a long-lived HTTP response that streams data: lines. It is one-way — server to client — which sounds like a limitation until you notice that a live map is one-way for 99% of its traffic.
// Client: subscribe once, get pushed updates, auto-reconnects for free const source = new EventSource("/api/live/flights/stream"); source.addEventListener("flights", (e) => { const { updated, removed } = JSON.parse(e.data); // Batch into one map source update per frame — never per aircraft queueFlightUpdate(updated, removed); }); source.onerror = () => { // EventSource retries automatically with Last-Event-ID. // Only intervene if it stays CLOSED (server said stop). if (source.readyState === EventSource.CLOSED) { setTimeout(() => location.reload(), 30_000); } }; // Server (Node): a stream is just a response you don't end app.get("/api/live/flights/stream", (req, res) => { res.writeHead(200, { "Content-Type": "text/event-stream", "Cache-Control": "no-cache", Connection: "keep-alive", }); const send = (batch) => res.write(`event: flights\ndata: ${JSON.stringify(batch)}\n\n`); const unsub = flightBus.subscribe(send); const ping = setInterval(() => res.write(`: ping\n\n`), 25_000); req.on("close", () => { clearInterval(ping); unsub(); }); }); Why SSE won the fast layers for us:
- Automatic reconnect with
Last-Event-IDis built intoEventSource— the browser resumes and the server can replay what was missed. That was ~40 lines of WebSocket client code we deleted. - It is still HTTP. Auth headers/cookies, logging, and proxies mostly just work (disable response buffering at your proxy, and send the 25-second
: pingcomment above so idle connections are not killed). - Deltas, not snapshots. A stream lets you send "these 212 aircraft moved, these 9 left coverage" — typically 8–15 KB per batch — instead of re-sending a 400 KB full snapshot on every poll.
SSE's limits: one-way only (client actions still go over normal fetch, which was fine for us), a per-origin connection limit under HTTP/1.1 (use HTTP/2, where streams multiplex), and no binary payloads — everything is UTF-8 text, so encode compactly.
What we actually measured
Same flight dataset, same users, three prototypes, one week apart. Illustrative medians from our logs — your numbers will differ, the shape usually doesn't:
| Poll (10 s) | WebSocket | SSE | |
|---|---|---|---|
| Median data age on screen | ~7 s | ~5.5 s | ~5.5 s |
| Bytes / user / hour | ~9 MB (full snapshots) | ~2.1 MB (deltas) | ~2.1 MB (deltas) |
| Requests / user / hour | 360 | 1 connection | 1 connection |
| Server state per user | None | Socket + subscriptions | Response + subscription |
| Reconnect handling | N/A | Hand-written | Built into the browser |
The honest headline: WebSocket and SSE tied on freshness because the source was the bottleneck, not the transport. SSE won on simplicity. Polling lost on bandwidth only because we sent full snapshots — deltas and ETags would have closed most of that gap.
The hybrid we shipped
- Poll (60–300 s, conditional): earthquakes, fires, radar metadata. Slow sources, cache-friendly, zero connection state.
- SSE (delta batches every ~5 s): flights. Satellites are propagated client-side between daily TLE updates, so they need no stream at all.
- Plain fetch on demand: camera snapshots — a camera only matters when a user opens it, so nothing streams until then.
- WebSockets: none in production today. If we add live collaboration or user-to-server telemetry at high frequency, this is where it will land — for that feature, not for the whole map.
One more rule: whatever the transport, batch rendering updates to one map setData per animation frame. A perfect stream feeding 60 source swaps a second still produces a janky map.
A note on public APIs
The same logic shapes the API we expose. WorldEye's public developer API is read-only, covers rights-cleared cameras only, and returns metadata plus snapshots/links — polling-friendly, cacheable HTTP, with rate limits and keys. We did not add a streaming public API, because the underlying rights and cadences do not justify one. Design the API around the data's real cadence and rights, not around the most impressive transport demo.
Pick by cadence, keep the receipt
- Source updates slower than a minute? Poll it, with
ETags and jitter. - Server-to-client pushes, client mostly silent? SSE.
- Client talks as much as it listens? WebSockets — and budget for the connection state.
Then measure data age on screen, not socket latency in isolation. The transport is rarely the slow part of a live map; the feed usually is.
Go look
Open worldeye.app, turn on Flights next to Earthquakes, and check your network tab: which layers arrive as periodic fetches, which feel continuous — and is the continuous one actually fresher, or just busier? That question, per layer, is the whole design method.
Building a live map and torn between polling and a socket? Tell me your source's real update cadence in the comments — that number usually settles it.