Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I am using WebSockets server on ESP8266 from this library. Classical schema, nothing overcomplicated: client is written on JavaScript, running on browser, used to control ESP8266 device. I am using WSServer.broadcastTXT() to send json messages back to clients to update their web-page. Everything working very good for days, until problem happened.

Problem: If client is gone (for example, client cell phone has lost wifi) - web socket server takes very long time, around 20 minutes (!), to disconnect missing client. I see the call of WSServer.broadcastTXT() takes more than WEBSOCKETS_TCP_TIMEOUT mS, which is clearly understandable, but how to make the disconnection to trigger faster that that? Using WSServer.enableHeartbeat() with tight timing, like WSServer.enableHeartbeat(30000, 100, 3), does not change anything, except adding extra network traffic for ping-pong messages. If client just close page in browser - client closes correctly.

Are there any solution on how to enforce web socket server to disconnect missing client much earlier than 20 minutes? What is the logic of disconnection of client(s) on server side?

You must be logged in to vote

Replies: 2 comments

Comment options

First step is to enable debug logging and look at the output.
all client lost detection comes from the fact the the TCP stack does not get a ACK for the send data (e.g. the ping).
a tcpdump is needed if the debug log does not shows anything, but one step at a time.

You must be logged in to vote
0 replies
Comment options

Are there any solution on how to enforce web socket server to disconnect missing client much earlier than 20 minutes?

Have a look at issue #922 I've made some changes to the HeartBeat code. That should solve it.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.