LearnBoost / up

Zero-downtime reloads and requests load balancer based on distribute.
540 stars 73 forks source link

How does up work with socket.io? #19

Closed bijoutrouvaille closed 12 years ago

bijoutrouvaille commented 12 years ago

The most basic example I could come up with, where socket.io is listening to an http server, yielded this warning:

   up test.js --port 8888
   info  - socket.io started
   info  - socket.io started
   warn  - error raised: Error: listen EADDRINUSE
   info  - socket.io started
   warn  - error raised: Error: listen EADDRINUSE

but for my current, larger project, into which I'm hoping to integrate up, I'm using a popular technique of storing a session object inside the handshake authorization and when using up to launch the server encountering these warnings and a lack of socket connectivity:

up ./app/index.js --port 8888
info  - socket.io started
  up-cli starting cluster with 2 workers on port 8888
  up-cli `kill -s SIGUSR2 10331` or ctrl + r to load new code
  up spawning 2 workers from master 10331
  up worker 10333 created
  up worker 10334 created
   info  - socket.io started
  up worker 10333 listening on port 63409
   info  - socket.io started
  up worker 10334 listening on port 63412
   info  - handshake authorized 14777588931060129542
   warn  - client not handshaken client should reconnect
   info  - transport end

I wonder if there's a simple fix available or if this is a part of a larger problem not yet solved...

rauchg commented 12 years ago

Use .ws middleware to forward WebSocket traffic.