SSE(EventSource): why no more than 6 connections?
The reason could be every EventSource object initiates the new HTTP session and in fact opens new tcp/ip socket. Because of you're pushing data from server continuously in infinite loop, the socket keeps open continuously.All web browsers has an upper limit on simultaneous active HTTP/1 connections to the same server. Normally in range of 4 to 6 as per RFC 2616. Your browser just preventing new connection to be open as this limit to be exceeded.
With HTTP/2 and HTTP/3, the limit is higher (100 connections by default).
You may learn here some more info as well:
http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/
See the Connections per Hostname column here: http://www.browserscope.org/?category=network&v=1
More information than anyone could possibly want, and it shows the observed "6" is basically just convention.
RFC2616 suggests a limit of 2, but everyone ignores it. So http://trac.tools.ietf.org/wg/httpbis/trac/ticket/131 removes that suggestion.
Customization
It appears IE can be configured from the registry.
Firefox can be configured from within about:config, filter on network.http
for various settings; network.http.max-persistent-connections-per-server
is the one to change.
Chrome cannot be configured at the current time.
Opera can be configured by going to about:config
, then opening "Performance" and changing "Max Persistent Connections Server".
Safari? No, not configurable, apparently.
Referring this https://developer.mozilla.org/en-US/docs/Web/API/EventSource
It is stated that Firefox and Chrome set the limit on the number of connections opened by a browser + domain.
When not used over HTTP/2, SSE suffers from a limitation to the maximum number of open connections, which can be specially painful when opening various tabs as the limit is per browser and set to a very low number (6). The issue has been marked as "Won't fix" in Chrome and Firefox. This limit is per browser + domain, so that means that you can open 6 SSE connections across all of the tabs to www.example1.com and another 6 SSE connections to www.example2.com. (from Stackoverflow). When using HTTP/2, the maximum number of simultaneous HTTP streams is negotiated between the server and the client (defaults to 100).