locked
Change ReconnectDelay RRS feed

  • Question

  • User-1140791523 posted

    Hi

    How is it possible to change ReconnectDelay in SignalR?

    Thursday, March 5, 2015 8:45 AM

Answers

  • User-1140791523 posted

    Thank you.

    But the ReconnectDelay you say is an instance property in all of the transport classes.

    Where am I expected to get the instances of the transports the SignalR itself creates and uses for persistent/hub connections?

    It would have been much easier there to be a global ReconnectDelay config such as GlobalHost.Configuration.ReconnectDelay by which you could apply that to all transports.

    Also, that would be more useful if there was a reconnectDelay config in javascript clients, so that we could use it this way:

    var connection = $.connection("/realtime/chat");
    
    connection.start({ reconnectDelay: 5000 }).done(function() {
    // ...
    });

    Basically, I think if there was a GlobalHost.Configuration.ReconnectDelay, we could set the setting in server-side and the clients get it from the server in negotiation phase.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 5, 2015 11:30 AM

All replies

  • User281315223 posted

    If you are referring to the ReconnectDelay property related to Long Polling, you should be able to set it as follows :

    // Set the reconnect delay for 30 seconds
    SignalR.Transports.LongPollingTransport.ReconnectDelay = TimeSpan.FromSeconds(30);

    The ServerSentEventsTransport also has the same property :

    SignalR.Transports.ServerSentEventsTransport.ReconnectDelay = TimeSpan.FromSeconds(30);

    This article on handling Connection, Reconnection and Timeout events in SignalR may be worth looking into as well.

    Thursday, March 5, 2015 9:16 AM
  • User-1140791523 posted

    Thank you.

    But the ReconnectDelay you say is an instance property in all of the transport classes.

    Where am I expected to get the instances of the transports the SignalR itself creates and uses for persistent/hub connections?

    It would have been much easier there to be a global ReconnectDelay config such as GlobalHost.Configuration.ReconnectDelay by which you could apply that to all transports.

    Also, that would be more useful if there was a reconnectDelay config in javascript clients, so that we could use it this way:

    var connection = $.connection("/realtime/chat");
    
    connection.start({ reconnectDelay: 5000 }).done(function() {
    // ...
    });

    Basically, I think if there was a GlobalHost.Configuration.ReconnectDelay, we could set the setting in server-side and the clients get it from the server in negotiation phase.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 5, 2015 11:30 AM