In case of an unrecoverable error, if there's a retry policy set for the HubConnection, instead of calling the OnError event the hub will try to reconnect to the server.
Automatic reconnection and the IRetryPolicy interface¶
/// <summary>/// Defines a contract for implementing retry policies in case of connection failures./// </summary>publicinterfaceIRetryPolicy{/// <summary>/// This function must return with a delay time to wait until a new connection attempt, or null to do not do another one./// </summary>TimeSpan?GetNextRetryDelay(RetryContextcontext);}
GetNextRetryDelay receives a RetryContext object as a parameter and must return a TimeSpan indicating a delay between the next reconnect attempt, or null to do not try to do further attempts and report the connection broken.
As can be seen from the code above, Best SignalR, by default, uses [0, 2, 10, 30] seconds of delays before giving up and considering the SignalR hub connection as failed.