title: how to distribute socket.io
body: <p>Im using nodejs and socket.io to deliver a chat on my business app, but i want to distribute the deploy so i can have as many chat servers i want to balance the load of the traffic.</p>
  
  <p>I try the load balance approach from nginx but that just do that balance the traffic but the communication between the socket.io serves its not the same, so one chat message send from user A to server S1 wont travel to user B on server S2.</p>
  
  <p>There is any tool or approach to do this.</p>
  
  <p>Thanks in advance.</p>
  
  <p>===== EDIT =====</p>
  
  <p>Here is the architecture of the app.</p>
  
  <p>The main app frontend on PHP CodeIgniter lets tag it as PHPCI
  The chat app backend on NodeJs and SocketIO lets tag it as CHAT
  The chat model data on Redist lets tag it as REDIST</p>
  
  <p>So what i have now its PHPCI -> CHAT -> REDIST. That work just fine.</p>
  
  <p>What i need is to distribute the application so i can have as many PHPCI or CHAT or REDIST i want, example</p>
  
  <pre><code> PHPCI1    CHAT1
   PHPCI2 -&gt;       -&gt; REDIST1
   PHPCI3    CHAT2
  </code></pre>
  
  <p>Where the numbers represent instances not different apps.</p>
  
  <p>So a User A connected to PHPCI1 can send a message to a user B connected on PHPCI3.</p>
  
  <p>I think some queue in the middle of CHAT can handle this something like rabbitmq that can only use the SocketIO to deliver the messages to the client.</p>