HubConnection.Reconnected 事件

定义

在 失去其基础连接后成功重新连接时 HubConnection 发生。

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) 

事件类型

示例

以下示例将处理程序附加到 Reconnected 事件,并检查提供的参数以记录 ConnectionId。

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

注解

参数 String 将为 HubConnection的新 ConnectionId,如果跳过协商,则为 null。

适用于