Websockets or server sent events?
Hi,
I have an application that receives price data via a WebSocket. This data is mapped by the application and then forwarded to other applications. The question now arises whether SSE (Server-Sent Events) or WebSockets should be used to send the data to the other applications. It's important to note that the data must be sent continuously over days, weeks, or even months, which raises efficiency issues.
Ideally, there will always be a buyer for the incoming price data, provided all backends are running as expected. However, this requires that the entire system functions reliably.
It’s easy.
If data only needs to be sent from server to client: SSE
When data is sent back from the client to the server: Websockets
This is the difference between the two technologies: SSE is designed for one-sided communication from the server to the client, while Websockets is designed for a bidirectional.
So in the case SSE, except you want from the “other applications” that they send back any data.
In the core, both as far as I know the same technology, only that WebSockets still has a handshake with it to conduct communication bidirectionally.
The better choice would be Websocket because SSE needs its own HTTP connection for each connection.