HTTP Polling and Long Polling

Mitikaa Sama
Cache Me Out
Published in
2 min readSep 30, 2021

--

As a software engineer, you might come across these words pretty often, especially when you are participating in interviews that revolve around system design. Let’s talk about what they mean at a very high level.

Before we begin, let’s get the basics of HTTP out of our way.

What is HTTP?

HTTP is a protocol used to fetch resources via the web. It is a client-server protocol. The client will “request” a resource, and the server will send back the resource as a “response”.

HTTP is a unidirectional protocol, which means the communication is always initiated by the client.

What is HTTP Polling?

HTTP Polling is a mechanism where the client keeps requesting the resource at regular intervals. If the resource is available, the server sends the resource as part of the response. If the resource is not available, the server returns an empty response back to the client.

What is HTTP Long Polling?

HTTP Long Polling is the mechanism where the client requests the server for a resource and waits for the server. The server returns a response when the requested resource is available. The HTTP connection is kept open until the server has the requested resource available, or the connection times out. When the response is received by the client, the connection is closed.
Once the previous connection is closed or timed out, the client then makes another request to the server and the cycle continues.

--

--