Wednesday, 1 July 2020

How to go by with socketio & cluster in the same machine?

So I have a socket.io functionality in my NodeJS app and I also use Cluster to run a worker for each CPU core on the server, but I realized that by doing that I'll be having a different socket.io instance for each one of the server instances, which is not good because if someone on instance #1 emit a message and other people are connected on instance #2 or some other instance then they won't get the message and vise versa...I'm looking for a solution that would work both on my linux (nginx) server and for me during development while running the server on my localhost...Would love to get a hint in the right direction :)

Submitted July 02, 2020 at 06:43AM by s_trader

No comments:

Post a Comment