-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I recently have a use case where I want to identify disconnection of clients quickly because of it's real-time functionality.
So to detect lost of connection more quickly, I set the signalr setting on my server as follows:
ASP net core 3.1
services.AddSignalR(c => {
c.ClientTimeoutInterval = TimeSpan.FromSeconds(5);
c.KeepAliveInterval = TimeSpan.FromSeconds(12);
})
But turned out, this causes the clients to be constantly reconnecting.
So the question is:
- What happens if you try to set keep alive interval or timeout window to a low number like above? Is it bad practice?
- How to make it works and solve this issue of client constantly reconnecting?
- If this is considered a bad way, what are alternative ways you would suggest to detect lost of connection quickly?
Expected Behavior
Client shouldn't be forced to disconnect
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
3.1
Anything else?
I found a comment on client side 'keepAlive..' setting (Javascript) which say
The default value is 15,000 milliseconds (15 seconds). Allows the server to detect hard disconnects (like when a client unplugs their computer). The ping will happen at most as often as the server pings. If the server pings every 5 seconds, a value lower than 5 will ping every 5 seconds.
What does this actually mean? and why is it that way? (especially the part that say 'The ping will happen at most as often as the server pings.')
And on [SignalR-Client-Cpp], it doesn't have corresponding 'keepAlive..' setting or such on the hub_connection, why? Update: found the settings, it's on the 'signalr_client_config'