title: AWS application load balancer and socket.io
body: <p>I have a socket.io chat room running whose traffic is getting larger as we are running on one machine. We have ran benchmarks using the ws library for sockets and they do perform much better which would better utilize our hardware. This would come at a cost of having to rewrite our application though. </p>
  
  <p>Our socket.io application allows users to create private chat rooms which are implemented by using namespaces. E.g </p>
  
  <pre><code>localhost:8080/room/1
  localhost:8080/room/2
  localhost:8080/room/3
  </code></pre>
  
  <p>When everything is in one instance it is quite easy, but now we are looking to expand this capacity into multiple nodes.</p>
  
  <p>We run this instance in Amazon's cloud. Previously it looked like scaling websockets was an issue with ELBs. We have noticed that Amazon now supports and application load balancer which supports websockets. This sounds great but after reading the documentation I must admit I don't really know what it means. If I am using socket.io with thousands of namespaces do I just put instances behind this ALB and everything will work?My main questions is:</p>
  
  <p>If x number of users join a namespace, will the ALB automatically redirect my messages to and from the proper users? So let's say I have 5 vanilla socket.io instance running behind the ALB. User 1 creates a namespace. Few hours later pass and User 99999 comes and wants to join this namespace, will there need to be any additional code written to do this or will the alb redirect everything where it should go? The same goes for sending and receiving messages?</p>