[SignalR] Add an option to enable client side ping check instead of only relying on client side PingMessage
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is your feature request related to a problem? Please describe.
The issue is SignalR server-side relies on the first `PingMessage` to enable the client-side ping check.
https://github.com/dotnet/aspnetcore/blob/2ad8121efbdddd46920918bddb9ee67e1c4144a9/src/SignalR/server/Core/src/Internal/DefaultHubDispatcher.cs#L180
However, if the client-side sends out messages constantly and **more frequently** than keep alive, the client never has any chance to send out `PingMessage`, and as a result the server-side ping check never invokes.
https://github.com/dotnet/aspnetcore/blob/d5cf36acc71fe576541bbb8d694a88815c22c800/src/SignalR/clients/ts/signalr/src/HubConnection.ts#L344
And this can cause the issue that when using SSE to connect to the service, although client fails to send to the server when JWT token expiration(401), the connection never closes, like described here https://github.com/Azure/azure-signalr/issues/943
### Describe the solution you'd like
Provide an option to **explicitly enable** the ping check through `SignalROptions` can solve the issue.
Contributor guide
Assessment
This issue has not been assessed yet.