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.
Tested HTML file from the server and issue remains.
Doesn't seem to timeout, either. Have waited over 10 minutes - several times, just to be sure.
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).
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?
this is socket.io issue fixed it here socketio/socket.io-client#354