Skip to the page

Networking & HTTP · Trade-off

Real-time: WebSockets vs SSE vs long polling

The interviewer asks

Live order tracking, a chat app and a stock ticker. Which transport for each, and why?

Then

Follow-ups the interviewer asks next

  1. Reconnect with backoff, heartbeats, resuming from a last event id.
  2. Scaling WebSockets (sticky sessions, pub/sub).
  3. Streaming fetch with a ReadableStream for LLM responses.
  4. Battery and network on mobile.

The answer

What a strong answer covers

  • Polling is simple and wasteful; SSE is server→client, over HTTP, with auto-reconnect; WebSockets are bidirectional and need more infrastructure
  • Choose based on direction, frequency and infrastructure

The red pen

Common traps

Avoid:WebSockets for everything.

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview