uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.76k stars 563 forks source link

Close connection if there is no response on auto ping #957

Closed zdm closed 1 year ago

zdm commented 1 year ago

I it possible to add possibility to automatically close websocket connection it there is no pong response to the auto ping? This would be useful to close broken connections.

For example it could be implemented like this:

  1. add new timeout - noDataReceiveTimeout;
  2. noDataReceiveTimeout` reached;
  3. send auto ping;
  4. if pong or other data was received - ok, do nothing;
  5. second noDataReceiveTimeout` reached - if no data was received between two timeouts - close connection;
e3dio commented 1 year ago

It does that now since v19, auto send ping before idleTimeout and close connection if no response

zdm commented 1 year ago

Ah, perfect thank you