I would like to know what will happen if the user is inactive.
Imagine user connected to the hub, the connection is established, but user doesn't refresh the page or doesn't do anything for an hour ... will the connection be maintained anyway?
And after that time can the message be pushed to him?
The default keepalive timeout period is currently 20 seconds. If your client code tries to call a Hub method while SignalR is in reconnecting mode, SignalR will try to send the command. Most of the time, such attempts will fail, but in some circumstances they might succeed.
hub. stop(). done(function() { alert('stopped'); });
To test reconnect after the server goes down use iisreset. To simulate client connection dropping (good luck) pull the network cable :) Pulling the network cable won't accurately simulate a client connection dropping when you're using Azure SignalR Service.
Timeout configuration for SignalR can be set in Application_Start method of Global class in Global. asax. cs file. // Wait a maximum of 30 minutes after a transport connection is lost // before raising the Disconnected event to terminate the SignalR connection.
SignalR sends keep-alive messages which will keep the connection open even if there is no other activity (except for long-polling connections; in that case, the client will make its regular ajax requests which has the same effect of keeping the connection alive). So you'll be able to send a message after an hour of inactivity, for example.
If the client device goes into sleep mode or can't send those keep-alive messages for any other reason, then the connection will eventually be removed (you can determine the timeout via GlobalHost.Configuration.DisconnectTimeout
). Take a look at the documentation for a more detailed explanation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With