Chat application across Multiple IP Addresses

301 views Asked by At

I have implemented Node.js and Socket.io in a few different applications with success. They are all fairly simple websites. They required just one Apache web server with Node.js/Socket.io running in the background to receive and send instant messages to a few hundred users connected at one time.

Now, I'm having trouble understanding how to run similar applications where users could be connected to any one of 5 different Apache web servers, all load balanced.

For example, suppose User #1 is connected to server 10.10.10.1 (one of the 5 load-balanced servers) and starts to chat with other users (using Node.js/Socket.io) which is also running on 10.10.10.1.

Then, User #20 connects to 10.10.10.2 and wants to start chatting with users on 10.10.10.1. How would I make the bridge to 10.10.10.1 so that User #20 can start chatting with other users? Similarly, how could I broadcast a message to all users, no matter if they're currently connected to 10.10.10.1 or 10.10.10.2 ... etc?

Can you recommend how to set up an environment that spans multiple servers (ip addresses) with Socket.io so messages can be sent and received to users no matter which server they're connected to?

0

There are 0 answers