My Understanding of HTTP Polling, Long Polling, HTTP Streaming and WebSockets

前端 未结 4 996
猫巷女王i
猫巷女王i 2020-12-12 09:13

I have read many posts on SO and the web regarding the keywords in my question title and learned a lot from them. Some of the questions I read are related to specific implem

4条回答
  •  生来不讨喜
    2020-12-12 09:38

    HTTP limits the number of connections a client can have with a server to 2 (although this can be mitigated by using subdomains) and IE has been known to enforce this eagerly. Firefox and Chrome allow more (although I can't remember of the top of my head exactly how many). This might not seem like a huge issue but if you are using 1 connection constantly for real-time updates, all other requests have to bottleneck through the other HTTP connection. And there is the matter of having more open connections from clients puts more load on the server.

    WebSockets are a TCP-based protocol and as such don't suffer from this HTTP-level connection limit (but, of course, browser support is not uniform).

提交回复
热议问题