Does http protocol standard support long polling?
Solution 1:
Long polling means that the response to request is not sent immediately, only when it is available. HTTP as a protocol has no requirements about the time response generation should take.
The client decides how long it is willing to wait for server's response once it makes a HTTP request.
Similarly, the HTTP server has freedom to send response at any time after HTTP request has been sent.
For example:
Client sends an HTTP request, and waits for response for 5 minutes. If it doesn't receive a response within five minutes, the request times out. In long-polling scenario, client sends another HTTP request and so on.
Respectively on server side, the request processing loop reads the HTTP request and then waits for some entity to generate the response payload, which it then sends back to the client.
Clients cannot control how servers operate. There is no "long-polling requests" as a concrete concept on clients.
There are only HTTP requests, where server decides when to send the answer, and clients who decide how long they are willing to wait.