SSE is based on HTTP protocol, and ws
requires one time HTTP upgrade.
For a small user base, I understand, WebSocket is way too good over SSE.
I am worried about how much difference will it be for 10,000 user chat system. Here the major concern is:
For WebSocket, I will have to run a loop for 10,000 connections to emit a message every time a new message is received.
For SSE, there is no loop, but a single server-sent event that will stream data to 10,000 users.
To me, Looking on paper it looks like SSE is best for such a large number, especially when numbers of connected clients will keep increasing to 20,000, 100,000. There is no 10,000 value loop running for every new message.
Is it practically true as well? I tried searching quite some performance benchmark for WebSocket vs SSE but can't find any.
Please confirm, if SSE will have better performance and low server resource utilization over WebSocket for emitting / streaming messages to such a large no. of users?