title: Socket.io Websockets on a TCP configured Amazon Elastic Load Balancer
body: <p>I'm planning to set up a group of NodeJS application servers running <a href="http://socket.io/">Socket.io</a> on EC2, and I'd like to use the <a href="http://aws.amazon.com/elasticloadbalancing/">Elastic Load Balancer</a> to spread load between them. I know ELB doesn't support Websockets out of the box, but I can use the setup described <a href="http://johan.heapsource.com/post/31047804966/the-state-of-websockets-ssl-and-sticky-sessions-in">here in Scenario 2</a>.</p>
  
  <p>As described in <a href="http://johan.heapsource.com/post/31047804966/the-state-of-websockets-ssl-and-sticky-sessions-in">the blog post</a>, though, I notice that this setup offers no session affinity or source IP info:</p>
  
  <blockquote>
    <p>We can not have Session Affinity nor X-Forward headers with this setup
    because ELB is not parsing the HTTP messages, so its impossible to
    match the cookies to ensure Session Affinity nor Inject special
    X-Forward headers.</p>
  </blockquote>
  
  <p>Will Socket.io still work under these circumstances? Or is there another way to have a set of Socket.io app servers behind a load balancer with SSL?</p>
  
  <p>EDIT: Tim Caswell talks about doing this already <a href="https://groups.google.com/d/msg/nodejs/202v7KPVG7s/eEK6RsWBCkoJ">here</a>. Are there any posts explaining how to set this up? Again there's no session stickiness here, but things seem to be working fine. </p>
  
  <p>As an aside, are sticky sessions actually necessary with websockets? Does information travel as new and separate requests or is there only one request + connection that all the information moves along?</p>