What is Long Polling

Long polling is a technique for simulating real-time server-to-client communication using standard HTTP. The client sends a request, and instead of responding immediately, the server holds the connection open until new data is available or a timeout occurs.

How it works

  1. Client sends GET /updates?since=123
  2. Server holds the connection open (no response yet)
  3. When new data arrives, the server responds with the data
  4. Client immediately sends a new request, restarting the cycle

The result looks like real-time push from the client's perspective. Each held request acts as a "waiting listener" on the server.

Why it matters

Long polling works everywhere — any HTTP client, any server, any proxy. It was the standard real-time technique before WebSockets and SSE existed. The tradeoffs: each pending request holds a server connection, the overhead of HTTP headers on every cycle adds up, and there's a gap between response and the next request where events can be missed.

See How WebSockets Work for a comparison of WebSockets, SSE, and polling approaches.