Skip to content

Lost connection not "disconnecting" #156

Closed
brihogan opened this Issue Nov 25, 2011 · 6 comments

2 participants

@brihogan

Am I doing something wrong? Seems like everyone.disconnect and now.core.on('disconnect') do not fire if the internet connection is lost. Only seems to fire when user closes the browser (or leaves the page). I can reproduce by using on my laptop and shutting off the wifi.

I'm guessing this may also be the case if the browser crashes? This makes me a little nervous since I have an array of connected users that I cannot clear out if the disconnect doesn't fire.

Is this a socket.io limitation?

Not sure if it matters, but I am running a locally stored HTML file that connects to my node server. I'll have to see if serving up the HTML file via the node server is any different.

@brihogan

Tested HTML file from the server and issue remains.

@brihogan

Doesn't seem to timeout, either. Have waited over 10 minutes - several times, just to be sure.

@brihogan

Seems odd since navigator.onLine works just fine. Shouldn't now or socket.io just check navigator.onLine if nothing else? I guess I can check it myself but seems redundant (also, not sure if that'd work on the server).

@brihogan

Further testing: works in Safari, does not work in Chrome or Firefox.

In Safari it throws an error: "WebSocket network error: The operation couldn't be completed. Socket is not connected."
It'd be nice if that error wasn't thrown. I'd like for user to be able to continue working offline, and errors don't look so good.

I think I heard socket.io was updated recently, perhaps this is the cause?

@vedratna

this is socket.io issue fixed it here socketio/socket.io-client#354

@brihogan

Awesome!

@brihogan brihogan closed this Dec 22, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.