HubConnection.Reconnected Event

Definition

Occurs when the HubConnection successfully reconnects after losing its underlying connection.

public:
 event Func<System::String ^, System::Threading::Tasks::Task ^> ^ Reconnected;
public event Func<string,System.Threading.Tasks.Task> Reconnected;
public event Func<string?,System.Threading.Tasks.Task>? Reconnected;
member this.Reconnected : Func<string, System.Threading.Tasks.Task> 
Public Event Reconnected As Func(Of String, Task) 

Event Type

Examples

The following example attaches a handler to the Reconnected event, and checks the provided argument to log the ConnectionId.

connection.Reconnected += (connectionId) =>
{
    Console.WriteLine($"Connection successfully reconnected. The ConnectionId is now: {connectionId}");
};

Remarks

The String parameter will be the HubConnection's new ConnectionId or null if negotiation was skipped.

Applies to