-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Feature request: Enable Websocket ping-pong and timeout #60620
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsCurrently, ManagedWebsocket only sends Although RFC is not described clearly about what should do if no The purpose here is to make sure the other side of connection is still alive, so as long as the connection can receive some bytes, we can treat it as alive. Sending I propose sending
|
Duplicate of #48729 |
Currently, ManagedWebsocket only sends
Pong
to keep live. It means it have to depend on TCP timeout to terminate a half-open connection. TCP timeout depends on OS and it's around 15 minutes in Linux, which is too long especially for the Websocket server side.Although RFC is not described clearly about what should do if no
pong
received after a period of time, I suggest we can have an option to enable a timeout.The purpose here is to make sure the other side of connection is still alive, so as long as the connection can receive some bytes, we can treat it as alive. Sending
ping
is just force the other side to send something back.I propose sending
Ping
instead ofPong
periodically here:https://github.com/dotnet/runtime/blob/main/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/ManagedWebSocket.cs#L546
And adding another periodically check to verify whether the connection not received anything for too long.
The text was updated successfully, but these errors were encountered: