FlashSocket.IO
FlashSocket.IO copied to clipboard
Client doesn't reconnect
When the server restarts, the client losses the connection and doesn't reconnect. Since a disconnection event is not thrown, there is no way to know that the client disconnected and also if there was, it's unclear as to how to achieve a re-connection.
I've noticed that while connected is true (even if the server went down), webSocket.socket.connected is false (hence it is more accurate).
How can a re-connection be done using this library?
Thanks, Ofir
Yes even I am facing this issue. The disconnect event on client side doesn't seem to work correctly. when the server dies or when the server sometimes discards the client sockets (don't know why). These disconnect events are not catched by the client. So there is really no way to know if the connection is still alive. Anybody who can help please?
@s888 @herzaso
Here's a quick hack.
Create a boolean in FlashSocket and check it at a greater interval than the heartbeat interval using a flash timer.
Set the boolean true every time you receive data from the server and set it to false at the timer interval.
Hence at the timer interval if the client has not received anything from the server then the boolean will be set to false at which point you can call the disconnect function and detect whether the client has disconnected.
Reconnection will also be possible in this case because the boolean will be set to true as soon as data is received from the server and the client will show as reconnected.