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

Need help to handle disconnection #61

Open
fuatsengul opened this issue Jul 20, 2015 · 6 comments
Open

Need help to handle disconnection #61

fuatsengul opened this issue Jul 20, 2015 · 6 comments

Comments

@fuatsengul
Copy link

Hi there
I've handled socket-error and socket-close events with your sample code but when I manually disconnect the client (like removing the ethernet cable) those handlers never goes in action.
If I shutted down the server, I see socket-close is works well.
Does it flashes any simple solution on your mind?
Any help will be appreciated :)
Thanks :)

ddpclient.on('socket-close', function(code, message) {
  console.log("Close: %s %s", code, message);
});

ddpclient.on('socket-error', function(error) {
  console.log("Error: %j", error);
});
@bsocius
Copy link

bsocius commented Sep 14, 2015

fuatsengul,

Did you already find a solution to your problem?

@fuatsengul
Copy link
Author

Hello Bsocius,

Actually I did not.
I made a workaround by setting a timer to check the connection at every 5 seconds and when connection was lost, it sets another timer to retry connecting to the server.

@vsivsi
Copy link
Member

vsivsi commented Sep 14, 2015

Is this an issue with the ddp-client, or with faye-websocket on top of which the ddp-client is built?

@emgee3
Copy link
Member

emgee3 commented Sep 14, 2015

I think the only actual issue is we (I) only implemented responding to heartbeats in the ddp v2 spec.

@clvLabs
Copy link

clvLabs commented Apr 29, 2016

Hi all!

I'm having the same issue as @fuatsengul:
If I disconnect the Ethernet cable while a DDP client connection is alive but not sending anything the disconnection goes unnoticed.

I've forked the project and will give it a try with the client heartbeat sending. ...

@fuatsengul
Copy link
Author

Hello @clvLabs,
If you haven't done it yet, I suggest to take a look forked repos. There's one that I liked it much more, (xolvio's) which it has promise support for method calls, so you can easily throw timeout exceptions and manage your connectivity state with this events.

Btw, hope those forks gets merged soon.

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

5 participants