HubConnectionBuilderExtensions.WithAutomaticReconnect 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
WithAutomaticReconnect(IHubConnectionBuilder) |
将 HubConnection 配置为在连接丢失时自动尝试重新连接。 客户端将分别等待默认的 0、2、10 和 30 秒,然后再尝试最多四次重新连接。 |
WithAutomaticReconnect(IHubConnectionBuilder, IRetryPolicy) |
将 HubConnection 配置为在连接丢失时自动尝试重新连接。 |
WithAutomaticReconnect(IHubConnectionBuilder, TimeSpan[]) |
将 HubConnection 配置为在连接丢失时自动尝试重新连接。 |
WithAutomaticReconnect(IHubConnectionBuilder)
将 HubConnection 配置为在连接丢失时自动尝试重新连接。 客户端将分别等待默认的 0、2、10 和 30 秒,然后再尝试最多四次重新连接。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::SignalR::Client::IHubConnectionBuilder ^ WithAutomaticReconnect(Microsoft::AspNetCore::SignalR::Client::IHubConnectionBuilder ^ hubConnectionBuilder);
public static Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder WithAutomaticReconnect (this Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder hubConnectionBuilder);
static member WithAutomaticReconnect : Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder -> Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder
<Extension()>
Public Function WithAutomaticReconnect (hubConnectionBuilder As IHubConnectionBuilder) As IHubConnectionBuilder
参数
- hubConnectionBuilder
- IHubConnectionBuilder
要配置的 IHubConnectionBuilder。
返回
用于链接的相同 IHubConnectionBuilder 实例。
适用于
WithAutomaticReconnect(IHubConnectionBuilder, IRetryPolicy)
将 HubConnection 配置为在连接丢失时自动尝试重新连接。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::SignalR::Client::IHubConnectionBuilder ^ WithAutomaticReconnect(Microsoft::AspNetCore::SignalR::Client::IHubConnectionBuilder ^ hubConnectionBuilder, Microsoft::AspNetCore::SignalR::Client::IRetryPolicy ^ retryPolicy);
public static Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder WithAutomaticReconnect (this Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder hubConnectionBuilder, Microsoft.AspNetCore.SignalR.Client.IRetryPolicy retryPolicy);
static member WithAutomaticReconnect : Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder * Microsoft.AspNetCore.SignalR.Client.IRetryPolicy -> Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder
<Extension()>
Public Function WithAutomaticReconnect (hubConnectionBuilder As IHubConnectionBuilder, retryPolicy As IRetryPolicy) As IHubConnectionBuilder
参数
- hubConnectionBuilder
- IHubConnectionBuilder
要配置的 IHubConnectionBuilder。
- retryPolicy
- IRetryPolicy
一个 IRetryPolicy ,它控制重新连接尝试的时间和次数。
返回
用于链接的相同 IHubConnectionBuilder 实例。
适用于
WithAutomaticReconnect(IHubConnectionBuilder, TimeSpan[])
将 HubConnection 配置为在连接丢失时自动尝试重新连接。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::SignalR::Client::IHubConnectionBuilder ^ WithAutomaticReconnect(Microsoft::AspNetCore::SignalR::Client::IHubConnectionBuilder ^ hubConnectionBuilder, cli::array <TimeSpan> ^ reconnectDelays);
public static Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder WithAutomaticReconnect (this Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder hubConnectionBuilder, TimeSpan[] reconnectDelays);
static member WithAutomaticReconnect : Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder * TimeSpan[] -> Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder
<Extension()>
Public Function WithAutomaticReconnect (hubConnectionBuilder As IHubConnectionBuilder, reconnectDelays As TimeSpan()) As IHubConnectionBuilder
参数
- hubConnectionBuilder
- IHubConnectionBuilder
要配置的 IHubConnectionBuilder。
- reconnectDelays
- TimeSpan[]
包含尝试每次重新连接尝试之前的延迟的数组。 数组的长度表示在客户端停止尝试重新连接之前,需要多少次失败的重新连接尝试。
返回
用于链接的相同 IHubConnectionBuilder 实例。