The HTTP persistent connection request policy is as follows:
The client initiates a request. If any response is returned, the request is processed and immediately resent. (That is, always have an activity request)
After the server receives the request, if there is no message, the connection will remain unresponsive and will not be returned until there is a message or more than n seconds.
The advantage of long polling is that if there is no message, the client will receive a request in n seconds.
If a message exists, it is immediately sent to the client. (If there is a new message when a request is responded, there is still a certain delay)
Compared with the persistent connection in IFRAME + script mode, it is easier to implement and does not display "loading" information in the browser.
In my personal understanding, using long polling with partial buffering can reduce server unlocking
A new message does not return immediately, but waits for a certain period of time to avoid excessive polling when messages are frequently sent.