WebSocket provides a bi-directional communication like a human being talks. The client can send data to the server and the server can send data to the client anytime. But wh
A bit late on this discussion but, BrokerJS is a reactive alternative you can try in NodeJS. Define a data model and subscribe websocket connections to specific keys of the model. Any changes to server side variable are automatically reflected on the client side. I think this will save you a lot of boilerplate code. Even better, you can still use the old-fashioned websocket messaging parallel to the new reactive way of doing things. It is far from a polished product and arrays are a headache. But in conjunction with something like VueJS, React or Svelte, I think it will save you a lot of trouble.
Disclaimer: I am the the author of BrokerJS.