Socket.io and multiple node instances

Socket.io is the most popular framework for web socket communication between node server and the client. Socket.io creates a session between server and client that allows for two way communication in an event-based manner that is familiar to JS developers. However, this solution creates a problem for typical node.js use case; that is running multiple instances. Due to the fact that each instance holds its own and only its own sessions, communication between client A connected to server instance A will not be seen by server instance B.

A simple diagram showing multi-instance setup.

In a case shown above, messages sent by Alice will never reach…

Piotr Frankowski

Software Architect/Lead Backend Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store