Back to the catalog

Real-time delivery: polling → SSE → WebSockets

19 questions

"Make it real-time" hides a ladder of escalating tradeoffs. Climb it: short polling, long polling, Server-Sent Events, and WebSockets — when each is the right tool, how the handshakes and wire formats actually work, what they cost to scale, and the operational details that bite (reconnection with backoff, message ordering, missed-message recovery, heartbeats, fan-out to thousands of clients, and proxy/load-balancer behavior). Checked against the specs (RFC 6455, WHATWG HTML) and grounded in the real browser APIs (EventSource, WebSocket) and Node server patterns.

Questions

  1. Not answered. Short polling vs. long polling: where does the latency go?
  2. Not answered. Why can naive long polling miss or reorder messages, and what is the standard fix?
  3. Not answered. What exact Content-Type makes a response an SSE stream?
  4. Not answered. Who reconnects for you: EventSource or WebSocket?
  5. Not answered. When EventSource auto-reconnects, which request header does it send so the server can resume the stream?
  6. Not answered. Why does the 7th SSE tab hang the whole app, and what removes the limit?
  7. Not answered. Which of these are genuine reasons to choose SSE over WebSockets?
  8. Not answered. Which statements about the WebSocket opening handshake are correct?
  9. Not answered. What numeric HTTP status code confirms the protocol switch succeeded?
  10. Not answered. What scheme does a WebSocket use when it runs over TLS?
  11. Not answered. Do you need sequence numbers to guarantee in-order delivery on one WebSocket?
  12. Not answered. You are building a collaborative document editor: many users send edits and receive others' edits with sub-second latency. Best transport?
  13. Not answered. Why are bearer tokens awkward with native EventSource and WebSocket, and what do teams do instead?
  14. Not answered. At the protocol level, how does WebSocket keep an idle connection alive and detect a dead peer?
  15. Not answered. What state is the server-side connection left in, and how do heartbeats help?
  16. Not answered. What's the most likely culprit killing idle connections at ~60 seconds, and the standard fix?
  17. Not answered. Why does plain exponential backoff still stampede, and what fixes it?
  18. Not answered. Why does long-polling need sticky sessions when a live WebSocket doesn't?
  19. Not answered. Which statements about cross-instance WebSocket fan-out are true?