becvert / cordova-plugin-websocket-server

Cordova WebSocket Server Plugin
MIT License
84 stars 35 forks source link

client losing network connection handling #37

Closed KosmoGalaxy closed 6 years ago

KosmoGalaxy commented 7 years ago

Android WebSocket client connects to the server. User goes away from the router and loses wifi connection. He comes back, connects back to wifi, but the server doesn't connect the new client - "open" event is not fired.

I don't know if "close" event fires. Both scenarios should be considered.

To make the client connect again, the server does not need to be restarted. Restarting wifi on the tablet with the server instantly corrects the problem.

Question aside. If the client is not closed after a period of "not being actually in the network anymore", how this situation should be handled?

becvert commented 7 years ago

For me, when a client loses the wifi, most likely they receive a transport close error. and should discard the websocket and reconnect with a brand new websocket upon being back on the wifi. Server side the socket may still be active until a ping timeout occurs in which case the server discard the socket as well.

To make the client connect again

are you reconnecting with a new websocket?

KosmoGalaxy commented 7 years ago

I'm connecting with a new websocket

becvert commented 6 years ago

cannot reproduce. closing now.