Share via


HubConnectionContext Class

Definition

Encapsulates all information about an individual connection to a SignalR Hub.

public ref class HubConnectionContext
public class HubConnectionContext
type HubConnectionContext = class
Public Class HubConnectionContext
Inheritance
HubConnectionContext

Constructors

HubConnectionContext(ConnectionContext, HubConnectionContextOptions, ILoggerFactory)

Initializes a new instance of the HubConnectionContext class.

HubConnectionContext(ConnectionContext, TimeSpan, ILoggerFactory, TimeSpan)

Initializes a new instance of the HubConnectionContext class.

HubConnectionContext(ConnectionContext, TimeSpan, ILoggerFactory)

Initializes a new instance of the HubConnectionContext class.

Properties

ConnectionAborted

Gets a CancellationToken that notifies when the connection is aborted.

ConnectionId

Gets the ID for this connection.

Features

Gets the collection of features available on this connection.

Items

Gets a key/value collection that can be used to share data within the scope of this connection.

Protocol

Gets the protocol used by this connection.

User

Gets the user for this connection.

UserIdentifier

Gets or sets the user identifier for this connection.

Methods

Abort()

Aborts the connection.

WriteAsync(HubMessage, CancellationToken)

Write a HubMessage to the connection.

WriteAsync(SerializedHubMessage, CancellationToken)

This method is designed to support the framework and is not intended to be used by application code. Writes a pre-serialized message to the connection.

Extension Methods

GetHttpContext(HubConnectionContext)

Gets HttpContext from the specified connection, or null if the connection is not associated with an HTTP request.

Applies to