I'm currently developing a simple web dashboard using the class com.sun.net.httpserver.HttpServer. In this dashboard i can create a certain number of EventSource in a monitoring page.
By using that i've noticed that after just 6 parallel EventSource my browser stops "subscribing" to them. To prove it i have developed a simple toy example. You can find it in the following github repo: https://github.com/wellsaid/SimpleSSEHTTPServer
As you can see in this screenshot the last two resources remains on waiting, while the first six starts receiving updates.
The output of my program is:
[Main] Creating the server object ...
[Main] Creating server context ...
[Main] Creating SSE contexts ...
[Main] Starting accepting requests!
[HttpRequestHandler] Received request from /0:0:0:0:0:0:0:1:47358: OK!
[Counter-Thread-5] Started
[Counter-Thread-1] Started
[Counter-Thread-3] Started
[Counter-Thread-2] Started
[Counter-Thread-4] Started
[Counter-Thread-6] Started
Which suggests that requests for resources 'counter7' and 'counter8' are never performed by the browser.
Finally, when i stop the server on the firefox debugger i can see this
Does this mean there is some sort of maximum number of EventSource the browser (or the server) can handle from one client? In which case, how do i increase them?
UPDATE: I think this is a problem of how the browser manages concurrency, since if i perform a request with curl on the resources 'counter7' and 'counter8' the server respond correctly: screenshot