When a client connects to my SignalR project and the client internet is disabled, the disconnect event is called (connection terminated) after about 15:40 minutes.
I noticed the problem recently as the last time I tried the same scenario, the connection was terminated after 30 seconds.
I tried to do the same thing without setting hub option and also by setting
services.AddSignalR(hubOptions =>
{
hubOptions.EnableDetailedErrors = true;
hubOptions.HandshakeTimeout = TimeSpan.FromSeconds(15);
hubOptions.ClientTimeoutInterval = TimeSpan.FromSeconds(30);
hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(15);
});
but still no difference.
I also ran the project with docker with and without setting
/proc/sys/net/ipv4/tcp_keepalive_time
value to 30 seconds but the client disconnected again in over 15 minutes.
I also tested it under net core 2,1, 2.2, and 3.0 but again no difference
I used two clients to test it, one with an android project and one with a c# client
I ran ngrok to expose the port 8223 to the public
ran the net core project with application url localhost:8223
connected the android client to it
when the log of the connection handshake handled was received, I disabled the internet
then after around 15 minutes the disconnect log was printed.
also tried to connect a c# client from a different computer to the net core project.
The connection handshake log was printed, I turned the internet off
and again the disconnect log was printed only after around 15 minutes .
Steps to reproduce the behavior:
After losing connection, the SignalR disconnect method must be called after 30 seconds if its hub option is not set or at the set interval when set, however it doesn't.
The screenshot shows the time it took for the disconnect method to be called
You're using a third-party library "com.smartarmenia:dotnetcoresignalrclientjava" which is not supported by us.
In order to have the server detect clients disconnecting within the configured timeout window, the client needs to be version 1.1 or higher for our supported clients and unsupported clients need to send a ping message to start the timeout.
You said you tried the C# client, what version were you using? And if you were using 1.1 or higher could you provide a repro app?
Closing this as we haven't heard from you and generally close issues with no response after some time. Please feel free to comment if you're able to get the information we're looking for and we can reopen the issue to investigate further!
I was using 1.0.4 version in the C# client, upgraded to 1.1 and it worked.
Thanks a lot for the help.