HubConnectionBuilder class

A builder for configuring HubConnection instances.

Methods

build

Creates a HubConnection from the configuration options specified in this builder.

configureLogging

Configures console logging for the HubConnection.

configureLogging

Configures custom logging for the HubConnection.

withHubProtocol

Configures the HubConnection to use the specified Hub Protocol.

withUrl

Configures the HubConnection to use HTTP-based transports to connect to the specified URL. The transport will be selected automatically based on what the server and client support.

withUrl

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

withUrl

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

Method Details

build

Creates a HubConnection from the configuration options specified in this builder.

function build()
Returns
HubConnection

configureLogging

Configures console logging for the HubConnection.

function configureLogging(logLevel: LogLevel)
Parameters
logLevel
LogLevel

The minimum level of messages to log. Anything at this level, or a more severe level, will be logged.

Returns
HubConnectionBuilder

configureLogging

Configures custom logging for the HubConnection.

function configureLogging(logger: ILogger)
Parameters
logger
ILogger

An object implementing the ILogger interface, which will be used to write all log messages.

Returns
HubConnectionBuilder

withHubProtocol

Configures the HubConnection to use the specified Hub Protocol.

function withHubProtocol(protocol: IHubProtocol)
Parameters
protocol
IHubProtocol

The IHubProtocol implementation to use.

Returns
HubConnectionBuilder

withUrl

Configures the HubConnection to use HTTP-based transports to connect to the specified URL. The transport will be selected automatically based on what the server and client support.

function withUrl(url: string)
Parameters
url
string

The URL the connection will use.

Returns
HubConnectionBuilder

withUrl

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

function withUrl(url: string, transportType: HttpTransportType)
Parameters
url
string

The URL the connection will use.

transportType
HttpTransportType

The specific transport to use.

Returns
HubConnectionBuilder

withUrl

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

function withUrl(url: string, options: IHttpConnectionOptions)
Parameters
url
string

The URL the connection will use.

options
IHttpConnectionOptions

An options object used to configure the connection.

Returns
HubConnectionBuilder