HubConnection 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
HubConnection(IConnectionFactory, IHubProtocol, ILoggerFactory)
初始化 HubConnection 類別的新執行個體。
public:
HubConnection(Microsoft::AspNetCore::SignalR::Client::IConnectionFactory ^ connectionFactory, Microsoft::AspNetCore::SignalR::Protocol::IHubProtocol ^ protocol, Microsoft::Extensions::Logging::ILoggerFactory ^ loggerFactory);
public HubConnection (Microsoft.AspNetCore.SignalR.Client.IConnectionFactory connectionFactory, Microsoft.AspNetCore.SignalR.Protocol.IHubProtocol protocol, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory);
new Microsoft.AspNetCore.SignalR.Client.HubConnection : Microsoft.AspNetCore.SignalR.Client.IConnectionFactory * Microsoft.AspNetCore.SignalR.Protocol.IHubProtocol * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.AspNetCore.SignalR.Client.HubConnection
Public Sub New (connectionFactory As IConnectionFactory, protocol As IHubProtocol, loggerFactory As ILoggerFactory)
參數
- connectionFactory
- IConnectionFactory
IConnectionFactory每次呼叫時,用來建立連線 StartAsync(CancellationToken) 的 。
- protocol
- IHubProtocol
IHubProtocol連接所使用的 。
- loggerFactory
- ILoggerFactory
記錄器工廠。
適用於
HubConnection(IConnectionFactory, IHubProtocol, IServiceProvider, ILoggerFactory)
初始化 HubConnection 類別的新執行個體。
public:
HubConnection(Microsoft::AspNetCore::SignalR::Client::IConnectionFactory ^ connectionFactory, Microsoft::AspNetCore::SignalR::Protocol::IHubProtocol ^ protocol, IServiceProvider ^ serviceProvider, Microsoft::Extensions::Logging::ILoggerFactory ^ loggerFactory);
public HubConnection (Microsoft.AspNetCore.SignalR.Client.IConnectionFactory connectionFactory, Microsoft.AspNetCore.SignalR.Protocol.IHubProtocol protocol, IServiceProvider serviceProvider, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory);
new Microsoft.AspNetCore.SignalR.Client.HubConnection : Microsoft.AspNetCore.SignalR.Client.IConnectionFactory * Microsoft.AspNetCore.SignalR.Protocol.IHubProtocol * IServiceProvider * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.AspNetCore.SignalR.Client.HubConnection
Public Sub New (connectionFactory As IConnectionFactory, protocol As IHubProtocol, serviceProvider As IServiceProvider, loggerFactory As ILoggerFactory)
參數
- connectionFactory
- IConnectionFactory
IConnectionFactory每次呼叫時,用來建立連線 StartAsync(CancellationToken) 的 。
- protocol
- IHubProtocol
IHubProtocol連接所使用的 。
- serviceProvider
- IServiceProvider
, IServiceProvider 包含提供給這個 HubConnection 實例的服務。
- loggerFactory
- ILoggerFactory
記錄器工廠。
備註
用來 IServiceProvider 初始化連線的 ,會在處置連接時處置。
適用於
HubConnection(IConnectionFactory, IHubProtocol, EndPoint, IServiceProvider, ILoggerFactory)
初始化 HubConnection 類別的新執行個體。
public:
HubConnection(Microsoft::AspNetCore::Connections::IConnectionFactory ^ connectionFactory, Microsoft::AspNetCore::SignalR::Protocol::IHubProtocol ^ protocol, System::Net::EndPoint ^ endPoint, IServiceProvider ^ serviceProvider, Microsoft::Extensions::Logging::ILoggerFactory ^ loggerFactory);
public HubConnection (Microsoft.AspNetCore.Connections.IConnectionFactory connectionFactory, Microsoft.AspNetCore.SignalR.Protocol.IHubProtocol protocol, System.Net.EndPoint endPoint, IServiceProvider serviceProvider, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory);
new Microsoft.AspNetCore.SignalR.Client.HubConnection : Microsoft.AspNetCore.Connections.IConnectionFactory * Microsoft.AspNetCore.SignalR.Protocol.IHubProtocol * System.Net.EndPoint * IServiceProvider * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.AspNetCore.SignalR.Client.HubConnection
Public Sub New (connectionFactory As IConnectionFactory, protocol As IHubProtocol, endPoint As EndPoint, serviceProvider As IServiceProvider, loggerFactory As ILoggerFactory)
參數
- connectionFactory
- IConnectionFactory
IConnectionFactory每次呼叫時,用來建立連線 StartAsync(CancellationToken) 的 。
- protocol
- IHubProtocol
IHubProtocol連接所使用的 。
- serviceProvider
- IServiceProvider
, IServiceProvider 包含提供給這個 HubConnection 實例的服務。
- loggerFactory
- ILoggerFactory
記錄器工廠。
備註
用來 IServiceProvider 初始化連線的 ,會在處置連接時處置。
適用於
HubConnection(IConnectionFactory, IHubProtocol, EndPoint, IServiceProvider, ILoggerFactory, IRetryPolicy)
初始化 HubConnection 類別的新執行個體。
public:
HubConnection(Microsoft::AspNetCore::Connections::IConnectionFactory ^ connectionFactory, Microsoft::AspNetCore::SignalR::Protocol::IHubProtocol ^ protocol, System::Net::EndPoint ^ endPoint, IServiceProvider ^ serviceProvider, Microsoft::Extensions::Logging::ILoggerFactory ^ loggerFactory, Microsoft::AspNetCore::SignalR::Client::IRetryPolicy ^ reconnectPolicy);
public HubConnection (Microsoft.AspNetCore.Connections.IConnectionFactory connectionFactory, Microsoft.AspNetCore.SignalR.Protocol.IHubProtocol protocol, System.Net.EndPoint endPoint, IServiceProvider serviceProvider, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.SignalR.Client.IRetryPolicy reconnectPolicy);
new Microsoft.AspNetCore.SignalR.Client.HubConnection : Microsoft.AspNetCore.Connections.IConnectionFactory * Microsoft.AspNetCore.SignalR.Protocol.IHubProtocol * System.Net.EndPoint * IServiceProvider * Microsoft.Extensions.Logging.ILoggerFactory * Microsoft.AspNetCore.SignalR.Client.IRetryPolicy -> Microsoft.AspNetCore.SignalR.Client.HubConnection
Public Sub New (connectionFactory As IConnectionFactory, protocol As IHubProtocol, endPoint As EndPoint, serviceProvider As IServiceProvider, loggerFactory As ILoggerFactory, reconnectPolicy As IRetryPolicy)
參數
- connectionFactory
- IConnectionFactory
IConnectionFactory每次呼叫時,用來建立連線 StartAsync(CancellationToken) 的 。
- protocol
- IHubProtocol
IHubProtocol連接所使用的 。
- serviceProvider
- IServiceProvider
, IServiceProvider 包含提供給這個 HubConnection 實例的服務。
- loggerFactory
- ILoggerFactory
記錄器工廠。
- reconnectPolicy
- IRetryPolicy
, IRetryPolicy 控制重新連線嘗試的時間和次數。
HubConnection如果 為 null, reconnectPolicy
則 不會重新連線。
備註
用來 IServiceProvider 初始化連線的 ,會在處置連接時處置。