ISSUE: Repeated disconnect/reconnect via random "disconnect event" firings

781 views
Skip to first unread message

Max Seiden

unread,
Mar 5, 2012, 1:02:39 PM3/5/12
to sock...@googlegroups.com
I've run into a strange issue where a connection is frequently ended and restarted on the server, via the "disconnect" event. I have no idea specifically what is emitting the "disconnect", but it occurs at fairly regular intervals, leading me to believe it has to do with the heartbeat timeout. I'm planning to go source diving later, but first wanted to check and see if this was a documented issue. I've also included the info and debug statements. 

   info  - socket.io started
   debug - served static content /socket.io.js
   debug - client authorized
   info  - handshake authorized 1636308112793994798
   debug - setting request GET /socket.io/1/websocket/1636308112793994798
   debug - set heartbeat interval for client 1636308112793994798
   debug - client authorized for 
   debug - websocket writing 1::
   debug - emitting heartbeat for client 1636308112793994798
   debug - websocket writing 2::
   debug - set heartbeat timeout for client 1636308112793994798
   debug - websocket received data packet 2::
   debug - got heartbeat packet
   debug - cleared heartbeat timeout for client 1636308112793994798
   debug - set heartbeat interval for client 1636308112793994798
   debug - emitting heartbeat for client 1636308112793994798
   debug - websocket writing 2::
   debug - set heartbeat timeout for client 1636308112793994798
   debug - websocket received data packet 2::
   debug - got heartbeat packet
   debug - cleared heartbeat timeout for client 1636308112793994798
   debug - set heartbeat interval for client 1636308112793994798
   info  - transport end
   debug - set close timeout for client 1636308112793994798
   debug - cleared close timeout for client 1636308112793994798
   debug - cleared heartbeat interval for client 1636308112793994798
Client disconnect // ( Emitted by my own disconnect listener )
   debug - discarding transport
   debug - client authorized
   info  - handshake authorized 11622896942027911398
// etc...

Mike Seman

unread,
Mar 5, 2012, 1:28:45 PM3/5/12
to sock...@googlegroups.com

Max,

 

Not sure if it’s what I was just dealing with, but per Brian’s advice, add this to your app/server.js

 

 

io.configure(function (){

                io.set('heartbeat timeout', 60);

                });

 

(or add the .set line if you already have an io.configure function going)

 

If that doesn’t help, try changing the port you’re using to serve on, for whatever reason, it stopped these disconnects for me.

 

Good luck,

Mike

Max Seiden

unread,
Mar 5, 2012, 1:38:19 PM3/5/12
to sock...@googlegroups.com
Mike,

Thanks! I actually just read the existing post about these discards and changed the intervals. Fixed the issue right away.

- Max
Reply all
Reply to author
Forward
0 new messages