-
Notifications
You must be signed in to change notification settings - Fork 45
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
Avoid websocket disconnects by sending pings #8
Conversation
@orottier Thank you for the PR. Did you have a chance to try this out? |
I did actually! The websocket did not disconnect for 9 days, which is better than the typical 2/3 days (needs more statistics, I know). However the client stopped receiving pongs at some point but it did not trigger a reconnect. Looking at the code, I'm probably not catching the Timeout properly and since it's wrapped in another promise I think the Exception does not propagate or something. I'll fix that and add some more logging, to be continued. |
It's been a wild ride Marcel
The bot has consistently stopped receiving pongs after three/four days. I'm running again with the updated code and will let you know if it finally works ;) |
Good news! The websocket connection dropped over the weekend, but was detected by this code and successfully reconnected. :) I guess we are good to go, but maybe you want to consider building the ping pong in the botman lib, instead of now asking the user to put in their own code
|
I could definitely use something like this. Are we close to being able to merge this? :) |
@mpociot Is it possible to merge this? I have the same (issue). |
usage (botman): ``` $loop->addPeriodicTimer(60, function () use ($botman) { $timeout = 2.0; $botman->getClient()->checkConnection($timeout); }); ```
Hi, I've rebased on the current master. @mpociot it would be great if you could merge and tag. To summarize, this lets the slack client listen for pings. If it does not receive a pong before $timeout, the websocket will reconnect. It's up to the client to actually initiate the pings via
|
Thank you very much for the work on this @orottier ! |
Thank you! Can somebody please push this to packagist.org?
|
re issue botman/driver-slack#13, I've taken a bit different approach than the POC in the issue discussion, let me know what you think.
I'll run this over the weekend, let's see if it actually works :)
usage (botman):