3 ms·
One thing that I've never understood is why websockets instead of server sent events?
by phaedryx 11y ago
One thing that I've never understood is why websockets instead of server sent events?
- jkarneges 11y agoWebSocket is more well known than SSE, and it's also what Socket.io uses, so I think this isn't always a conscious choice. Developers are still discovering that SSE is a thing. Another factor is that most apps using a socket-ish connection tend to run almost all traffic over the socket as opposed to just "push" traffic. This can make sense if the exchanges aren't very resource-oriented compared to a REST API.
- jamescun 11y agoPossibly Internet Explorer support. Even Edge doesn't support them yet[1]. With deployments of HTTP/2 increasing, I think we'll see greater adoption of server sent events. At the time of writing, HTTP/2 and WebSockets are two incompatible standards. For non-latency sensitive applications (i.e. not games) it is very easy to implement a WebSocket like interface over HTTP/2 using SSE (server -> client) and POST requests (client -> server) with very little overhead (thanks to HTTP/2's multiplexing). [1] http://caniuse.com/eventsource http://caniuse.com/eventsource
- djKianoosh 11y agoI'd love to use a sane, simple SSE server impl in Java. Does one exist? I see there's very little about plain java event source servlet implementations. Looks like there's some promising things in Jersey and Atmosphere at least, but things tend to get complicated quick in the java world...