Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client doesn't reconnect #21

Open
herzaso opened this issue May 23, 2013 · 2 comments
Open

Client doesn't reconnect #21

herzaso opened this issue May 23, 2013 · 2 comments

Comments

@herzaso
Copy link

herzaso commented May 23, 2013

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

@s888
Copy link

s888 commented Nov 26, 2013

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?

@gauravrane
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants