Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

HubConnectionBuilder Class

Definition

Namespace:
Microsoft.AspNetCore.SignalR.Client
Assembly:
Microsoft.AspNetCore.SignalR.Client.Core.dll
Package:
Microsoft.AspNetCore.SignalR.Client.Core v10.0.0
Package:
Microsoft.AspNetCore.SignalR.Client.Core v11.0.0-preview.4.26230.115
Package:
Microsoft.AspNetCore.SignalR.Client.Core v1.0.0
Package:
Microsoft.AspNetCore.SignalR.Client.Core v1.1.0
Package:
Microsoft.AspNetCore.SignalR.Client.Core v3.0.3
Package:
Microsoft.AspNetCore.SignalR.Client.Core v3.1.18
Package:
Microsoft.AspNetCore.SignalR.Client.Core v5.0.9
Package:
Microsoft.AspNetCore.SignalR.Client.Core v6.0.6
Package:
Microsoft.AspNetCore.SignalR.Client.Core v7.0.5
Package:
Microsoft.AspNetCore.SignalR.Client.Core v8.0.19
Package:
Microsoft.AspNetCore.SignalR.Client.Core v9.0.8
Source:
HubConnectionBuilder.cs
Source:
HubConnectionBuilder.cs
Source:
HubConnectionBuilder.cs
Source:
HubConnectionBuilder.cs
Source:
HubConnectionBuilder.cs
Source:
HubConnectionBuilder.cs
Source:
HubConnectionBuilder.cs
Source:
HubConnectionBuilder.cs
Source:
HubConnectionBuilder.cs
Source:
HubConnectionBuilder.cs
Source:
HubConnectionBuilder.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

A builder for configuring HubConnection instances.

public ref class HubConnectionBuilder : Microsoft::AspNetCore::SignalR::Client::IHubConnectionBuilder, Microsoft::AspNetCore::SignalR::ISignalRBuilder
public class HubConnectionBuilder : Microsoft.AspNetCore.SignalR.Client.IHubConnectionBuilder, Microsoft.AspNetCore.SignalR.ISignalRBuilder
type HubConnectionBuilder = class
 interface IHubConnectionBuilder
 interface ISignalRBuilder
Public Class HubConnectionBuilder
Implements IHubConnectionBuilder, ISignalRBuilder
Inheritance
HubConnectionBuilder
Implements

Constructors

Name Description
HubConnectionBuilder()

Initializes a new instance of the HubConnectionBuilder class.

Properties

Name Description
Services

Gets the builder service collection.

Methods

Name Description
Build()

Creates a HubConnection.

Equals(Object)

Determines whether the specified object is equal to the current object.

GetHashCode()

Serves as the default hash function.

GetType()

Gets the Type of the current instance.

ToString()

Returns a string that represents the current object.

Extension Methods

Name Description
AddMessagePackProtocol(ISignalRBuilder, Action<MessagePackHubProtocolOptions>)

Enables the MsgPack protocol for SignalR and allows options for the MsgPack protocol to be configured.

AddMessagePackProtocol(ISignalRBuilder)

Enables the MsgPack protocol for SignalR.

ConfigureLogging(IHubConnectionBuilder, Action<ILoggingBuilder>)

Adds a delegate for configuring the provided ILoggingBuilder. This may be called multiple times.

WithAutomaticReconnect(IHubConnectionBuilder, IRetryPolicy)

Configures the HubConnection to automatically attempt to reconnect if the connection is lost.

WithAutomaticReconnect(IHubConnectionBuilder, TimeSpan[])

Configures the HubConnection to automatically attempt to reconnect if the connection is lost.

WithAutomaticReconnect(IHubConnectionBuilder)

Configures the HubConnection to automatically attempt to reconnect if the connection is lost. The client will wait the default 0, 2, 10 and 30 seconds respectively before trying up to four reconnect attempts.

WithKeepAliveInterval(IHubConnectionBuilder, TimeSpan)

Configures KeepAliveInterval for the HubConnection.

WithMessagePackProtocol(IHubConnectionBuilder, MessagePackHubProtocolOptions)
WithMessagePackProtocol(IHubConnectionBuilder)
WithServerTimeout(IHubConnectionBuilder, TimeSpan)

Configures ServerTimeout for the HubConnection.

WithStatefulReconnect(IHubConnectionBuilder)

Configures the HttpConnectionOptions to negotiate stateful reconnect with the server.

WithUrl(IHubConnectionBuilder, String, Action<HttpConnectionOptions>)

Configures the HubConnection to use HTTP-based transports to connect to the specified URL.

WithUrl(IHubConnectionBuilder, String, HttpTransportType, Action<HttpConnectionOptions>)

Configures the HubConnection to use HTTP-based transports to connect to the specified URL and transports.

WithUrl(IHubConnectionBuilder, String, HttpTransportType)

Configures the HubConnection to use HTTP-based transports to connect to the specified URL and transports.

WithUrl(IHubConnectionBuilder, String)

Configures the HubConnection to use HTTP-based transports to connect to the specified URL.

WithUrl(IHubConnectionBuilder, Uri, Action<HttpConnectionOptions>)

Configures the HubConnection to use HTTP-based transports to connect to the specified URL.

WithUrl(IHubConnectionBuilder, Uri, HttpTransportType, Action<HttpConnectionOptions>)

Configures the HubConnection to use HTTP-based transports to connect to the specified URL and transports.

WithUrl(IHubConnectionBuilder, Uri, HttpTransportType)

Configures the HubConnection to use HTTP-based transports to connect to the specified URL and transports.

WithUrl(IHubConnectionBuilder, Uri)

Configures the HubConnection to use HTTP-based transports to connect to the specified URL.

Applies to


Feedback

Was this page helpful?