locked
Error on .Net SignalR Client "The client has been inactive since [Datetime] and it has exceeded the inactivity timeout of [Time]. Stopping the connection." RRS feed

  • Question

  • User2129799919 posted

    I have a Client SignalR hosted in a Windows Service, everything works correctly until the computer is Suspended, this causes the client to continue with the connection with the State Connected, as soon as the computer boots, the first attempt at using the HubProxy, an exception is caught in the Error event of the Connection object.

    In research that I've done, a new call to the start method must be performed so that the connection can be renewed.

    If this is correct, I need to identify within the method that handles the error event if this situation occurred (expired), and if yes, force a reconnection.

    How do I do it?

    Wednesday, May 17, 2017 6:07 PM

All replies

  • User-271186128 posted

    Hi VictorPerez2911,

    Error on .Net SignalR Client "The client has been inactive since [Datetime] and it has exceeded the inactivity timeout of [Time]. Stopping the connection."

    As far as I know, this error happens when the client got disconnected and could not reconnect within the ReconnectTimeout. I suggest you could try to use the following code to reconnect the server continuously:

    $.connection.hub.disconnected(function() {
       setTimeout(function() {
           $.connection.hub.start();
       }, 5000); // Restart connection after 5 seconds.you can set the time based your requirement
    });

    You can refer to the link about continousreconnect:

    http://www.asp.net/signalr/overview/signalr-20/hubs-api/handling-connection-lifetime-events#continuousreconnect

    Best regards,
    Dillion

    Thursday, May 18, 2017 7:24 AM