| You don't need websockets SSE works fine for realtime collaborative apps. Websockets sound great on paper. But, operationally they are a nightmare. I have had the misfortune of having to use them at scale (the author of Datastar had a similar experience). To list some of the challenges: - firewalls and proxies, blocked ports - unlimited connections non multiplexed (so bugs lead to ddos) - load balancing nightmare - no compression. - no automatic handling of disconnect/reconnect. - no cross site hijacking protection - Worse tooling (you can inspect SSE in the browser). - Nukes mobile battery because it hammers the duplex antenna. You can fix some of these problems with websockets, but these fixes mostly boil down to sending more data... to send more data... to get you back to your own implementation of HTTP. SSE on the other hand, by virtue of being regular HTTP, work out of the box with, headers, multiplexing, compression, disconnect/reconnect handling, h2/h3, etc. If SSE is not performant enough for you then you should probably be rolling your own protocol on UDP rather than using websockets. Or wait until WebTransport is supported in Safari (any day now ). Here's the article with a real time multiplayer Game of Life that's using SSE and compression for multiplayer. https://example.andersmurphy.com It's doing a lot of other dumb stuff explained a bit more here, but the point is you really really don't need websockets (and operationally you really don't want them): https://andersmurphy.com/2025/04/07/clojure-realtime-collabo... |
- What makes load balancing easier with SSE? I imagine that balancing reconnects would work similar to WS.
- Compression might be a disadvantage for binary data, which WS specializes in.
- Browser inspection of SSE does sound amazing.
- Mobile duplex antenna is way outside my wheelhouse, sounds interesting.
Can you see any situation in which websockets would be advantageous? I know that SSE has some gotchas itself, such as limited connections (6) per browser. I also wonder about the nature of memory and CPU usage for serving many clients on WS vs SSE.
I have a browser game (few players) using vanilla WS.