共用方式為


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。

適用於