Multiple Connections in node.js

I've been using node.js for a while and just playing around with the modules. I have a question, Is it possible to connect multiple node.js servers and have a communication link between them?

what I mean to say is, I have 3 node.js severs each handling different operations and different clients. I want to create link between these servers such that each servers can communicate.

server1 ==> [database]

server2 ==> room1[client1,client2,client3]

server3 ==> room2[client4,client5,client6]

I can create a connection between 2 servers using 'net', but how to do with multiple servers?

Lots of options here:

  • some kind of hub server (server 4). Servers 1-3 all symmetrical and are clients for server 4. Whenever message needs to be broadcasted, server 4 sends it to all clients. Possible solutions: dbus, 0mq/rabbitmq, redis pub/sub, socket.io
  • udp broadcasts
  • configure each server to have list of all servers and manually broadcast all incoming packets by iterating connections to neighbours. Need to use some kind of TTL field to avoid loops