Flotype / now

NowJS makes it easy to build real-time web apps using JavaScript
http://www.nowjs.com
MIT License
1.91k stars 175 forks source link

Lost connection not "disconnecting" #156

Closed brihogan closed 12 years ago

brihogan commented 13 years ago

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 commented 13 years ago

Tested HTML file from the server and issue remains.

brihogan commented 13 years ago

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

brihogan commented 13 years ago

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 commented 13 years ago

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 commented 12 years ago

this is socket.io issue fixed it here https://github.com/LearnBoost/socket.io-client/pull/354

brihogan commented 12 years ago

Awesome!