-
Notifications
You must be signed in to change notification settings - Fork 638
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
Added alert when websocket closes and trying to trigger it faster #2131
Conversation
btw what happens on ota, when device reboots? |
As far as i seen during reboot and ota it works just fine, it takes a bit of time since the websocket closed till the As far as i read online, this ping pong is the basics of keepalive in websockets, if you know a better way of doing it please suggest:) |
So far I only found info for proxy use-cases, where intermediate closes the connection when we dont send anything for 55-60 seconds. If the goal is to avoid that, sure that is fine. What I was asking about is whether we should have something like this:
|
I'm not sure that putting a timeout on pong response is a good thing to do, because there are scenarios where the communication on the websocket is slow but the websocket itself is still connected. When i tested it, i tried 3 scenarios
IMO the current implementation is fine because it don't cause any unneeded disruption to the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, we'll see then :)
otoh, only issue I can see with missing messages is webserver wsSend_P() may stumble upon the queuing issue. I will fix that some time in the future though.
edit: and in case tcp connection is slow and we see such long delays, it may do weird things it is true.
The webpage does not recognize websocket disconnections, this can cause major problems when still viewing the webpage while it happens (Any action like turning on the switch will seem working on the webpage but actually nothing happens)
I've added an alert when
websocket.onclose
happens and to make it trigger faster (if no websocket action happens it can take forever) I've added also a ping pong function to make some noise on the websocket.