This is a demo of using server-sent event under a clusterized node environment. Unlike WS, SSE does not require a handshake to establish a connection, so no additional magic is needed at load-balancing to ensure handshake requests are routed to the same node in the cluster.
The cluster environment is simulated with an http proxy.
Install dependencies: npm i
npm run single- From browser, go to
http://localhost: 3000 - Notice both websocket and SSE implementation works
npm run cluster- From browser, go to
http://localhost: 4000 - Notice that only SSE is working as WS fails to establish handshake.