What is long polling?

Long polling is a method of maintaining a connection with the server for an extended period of time. The client queries the server for fresh information in extended polling. A client’s connection is kept open for as long as feasible by the server. Only when the data has been delivered back to the client or a connection timeout has occurred is the connection terminated.

Long Polling Flow:

  1. The server receives a request.
  2. A client’s connection is held by the server until new data is available.
  3. When new information becomes available, the server answers the request.
  4. The browser makes a new request right away.