palavatv/palava-client

In chrome, the websocket connection is not closed on network disconnect

farao opened this issue · 2 comments

farao commented

If you disconnect your internet, Firefox will a few seconds later realize this and send the websocket closed event, Chrome does not do this and we need to find out how to simulate it?

Maybe this helps? https://stackoverflow.com/questions/26971026/handling-connection-loss-with-websockets (custom ping messages from the client side - unfortunately there is no way to trigger the websocket builtin ping messages in the browser from the javascript API).

calling-signaling supports ping messages initiated by the client as well as server pings that can be setup by the client with a user defined idle time (timer is reset on any activity on the channel).

The client can for example set up a server ping after 30 seconds idle time and send a ping itself after 45 seconds idle time. This way both sides will send messages after a defined time forcing an error if the connection is dead (preventing zombie peers on the server and giving the user feedback in the client).

Server side implementation for reference: https://github.com/Innovailable/calling-signaling/blob/master/src/ping.coffee

farao commented

Hm, ok, I see, there doesn't seem to be a way around manually sending ping messages on the client side. I started off by answering to those in the signal tower: palavatv/signaltower#22, since this adds {event: "ping"} and {event: "pong"} to the palava protocol, I'm looking for feedback.