Long Polling
NetworkingLong polling is a technique where the client makes an HTTP request and the server holds the connection open until new data is available or a timeout occurs, simulating real-time server push over standard HTTP.
In regular polling, the client repeatedly asks the server "do you have new data?" at fixed intervals — wasteful when updates are infrequent. Long polling improves this by having the server hold the request open until it has something to send.
The flow is: client sends a request, server holds it until data is available (or timeout), server responds, client immediately sends a new request. This creates a near-real-time experience without the complexity of WebSockets.
Long polling is simpler to implement than WebSockets and works through all proxies, firewalls, and load balancers that support HTTP. It's a good choice when real-time requirements are modest (seconds of latency are acceptable) or when WebSocket support is limited.
Drawbacks include higher server resource usage (each waiting client holds a connection open), potential for thundering herd problems (all clients reconnecting simultaneously after a broadcast), and slightly higher latency compared to WebSockets.
Related Terms
Ready to design?
Practice using long polling in a real system design on Supaboard's interactive whiteboard.
Browse Challenges