-
Notifications
You must be signed in to change notification settings - Fork 108
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
Do open sockets have a defined timeout? #25
Comments
Using 1.8.1 I've tried:
NEVER stays open for more than 2 minutes and 42-44 seconds, sometimes much less. |
Have that same problem |
Same in 1.8.2 . . . |
Hey guys: This is the library used for websocket https://github.com/vitalets/websocket-as-promised I didn't see anything related to timeout. Maybe the service needs to be pinged every x minutes to keep connection open? |
Hello have search today, the websocket as promised have the timeout 0 sa default, have add a onClose to my script and the result are "Connections closed: Connection dropped by remote peer." but find no result on google ... Any idea guys ? |
I have read on the web that the connection are close beacause we need to ping it, have try to send a switchDevice command every 15 sec and the server not close the conection. |
Guys, this worked for me: First, update
with:
Then on your script, add this code:
If this work for you, i will move the ping command inside the |
Hi, yesterday I have tried to ping with interval of 60000ms this have work all the night. I have detect the "pong" before the json.parse so I have no error. I will try your change and confirm if this work by me. |
Hello, Have tryed your code, but have an error :
|
Hello, Sorry, was not your code, have no error with your code, work nice !! I take this opportunity to say congratulations for your work! |
Perhaps 120s (120000ms) to reduce traffic as it appears the time out is 160s. |
Using release_1.10.0 Left an event monitor running overnight, looks like it crashed. I'm guessing the socket closed and the ping then fails:
Need to detect the socket closes and re-open it. I'll leave it till tomorrow to see if it drops itself before I disable access to coolkit.cc which will simulate dropping the connection. |
Make sure In main application I have:
So if the process is terminated it will close the web socket. Since adding this the app has gracefully closed the socket every time and always restarts 1st time. |
Martin, In order to keep the pong reply I return a sonoff type structure with the action being socket, eg:
In the calling code I now use:
I've also returned other states, eg socket opened, closed or error, I'll do a little more testing and then post the changes. |
Hi dear, This is a good idea, the pong message are for me important, so I can detect that all is ok. Thanks for your job ! |
Once the events listener starts it is likely to hang up at some point due to lost socket connection. I've made changes to the library to catch some of the conditions that result in the connection failing and the code just hanging up. Changes to openWebSocketMixin.js to catch communication errors more gracefully. Changed heartbeat to 6s just to speed up debug. Event loop (main):
Changes to openWebSocketMixin.js, replace:
with:
Running the code:
I'll use PM2 to handle restarting the process... |
Do open sockets have a defined timeout?
After a time in execution, it stops receiving events, some idea ?
Note: I'm using version 1.8.0
Thank you
Originally posted by @thorito in #5 (comment)
The text was updated successfully, but these errors were encountered: