-
Notifications
You must be signed in to change notification settings - Fork 255
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
How to send a ping every x seconds? #89
Comments
Second parameter in send() is opcode. When sending $client->send('Ping message', 'ping'); |
Thanks for answer. |
Correct, the |
Thats bad. Here is the manual of Gardena/Husquvarna: https://developer.husqvarnagroup.cloud/apis/GARDENA+smart+system+API#/readme And thats the text part which makes problems: |
Only thing to do is to expect socket to close and have it re-connect. As that API allows http-requests as well it should not be a problem. I will consider this use case for further development, though. |
What about this:
|
@mrsnut |
I've just opened a PR that helps with this - #140 |
I found an easier method. When you set up the client, set a timeout for the connection (one of the options parameters), like this: After that, in the catch where all the websocket errors are caught, you will get a timeout after not receiving data, every 20 seconds. Use this timeout to send a heartbeat.
|
I use the gardena websocket (smart API) which closes the connection every 200 seconds even I send no ping message.
How can I get this work?
The text was updated successfully, but these errors were encountered: