News for hackers. Stuff that matters.
Re:Server Sent Events by cassepipe on Tuesday May 16, 2023 @05:24AM (#35959417)
This SO answer seems to say that it wouldn't work : https://stackoverflow.com/questions/61041389/managing-server...

If you have an answer to that answer I'd be very much interested

Re:Server Sent Events by jraph on Tuesday May 16, 2023 @07:14AM (#35960191)
You can use BroadcastChannel [1] to communicate between tabs. It works well and does not require service workers. It's used in Tracim [2], for some reason we could not move to HTTP/2 at the time I was working on this project so we indeed learned about this connection limit soon enough…

Even on HTTP/2, I believe it's best avoid sending 6 times the same message to the user just because they opened 6 tabs. It's less wasteful both for the server and the client.

[1] https://developer.mozilla.org/en-US/docs/Web/API/BroadcastCh...

[2] https://github.com/tracim/tracim/blob/develop/frontend_lib/s...

Re:Server Sent Events by cassepipe on Tuesday May 16, 2023 @11:35AM (#35963295)
Thanks very much for the examples ! I get your point but it does seem quite more involved to do all that management and broadcasting by hand rather than having a shared worker with a EventSource singleton for all, don't you think : https://stackoverflow.com/a/61636606/10469162