HACKER Q&A
📣 iraldir

Any one with experience with Server Sent Event at scale?


Positive or negative experience, we're considering it as an alternative to websocket as we're only pushing data down and don't require upstream really


  👤 joshxyz Accepted Answer ✓
Couple thoughts

- Savings in bandwidth might be only noticeable if the demand for scale is real and you have already exhausted other optimizations available. Think of trade-offs, the performance gains might be there, but other factors count like how familiar is your team with it, how flexible or constricting it is, etc etc.

- WebSockets are easier to implement on the client-side, most developers are familiar with it, both in web app and mobile apps.

- Since WebSockets are bi-directional, it's easy to let client send any data (e.g. for debugging, tracing, monitoring) almost effortlessly any time you might need it (maybe not now, maybe in the future).

- WebSockets support binary data, you can use existing serialization formats like msgpack, or have your own binary serialization format.

- There are WebSocket web frameworks out there like uWebSockets (written in C & C++, has Node.js API), used by most trading platforms, which got better performance than most web frameworks out there.

- https://github.com/uNetworking/uWebSockets

- https://github.com/uNetworking/uWebSockets.js/

- https://github.com/uNetworking/uWebSockets/tree/master/bench...


👤 sharps_xp
I don't have experience, but would like to experiment with this as well mostly because of rails 7's turbo broadcasts can use SSE instead of websockets. From my research so far, as a frugal dev, I'm trying to figure out how different hosting providers handle long-lived connections. I basically have to put my app behind an nginx proxy b/c ruby web servers won't be friendly with so many SSE connections.