4 ms·
I got interested and found this nice thread on SO: https://stackoverflow.com/a/5326159 https://stackoverflow.com/a/5326159 One of the drawbacks, as I learned -
by vindex10 2y ago
I got interested and found this nice thread on SO: https://stackoverflow.com/a/5326159 https://stackoverflow.com/a/5326159
One of the drawbacks, as I learned - SSE have limit on number of up to ~6 open connections (browser + domain name). This can quickly become a limiting factor when you open the same web page in multiple tabs.
- CharlieDigital 2y agoAs the other two comments mentioned, this is a restriction with HTTP/1.1 and it would apply also to long polling connections as well.
- arresin 2y ago…if you’re using http/1.1. It’s not an issue with 2+
- Klonoar 2y agoNot an issue if you’re using HTTP/2 due to how multiplexing happens.
- _heimdall 2y agoSyncing state across multiple tabs and windows is always a bit tricky. For SSE, I'd probably reach for the BroadcastChannel API. Open the SSE connection in the first tab and have it broadcast events to any other open tab or window.
- bioneuralnet 2y agoI've gotten around this by using the Page Visibility API - https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibi.... Close the SSE connection when the page is hidden, and re-open when it becomes visible again.