HubConnectionContext 类

定义

封装有关与 SignalR 中心的单个连接的所有信息。

public ref class HubConnectionContext
public class HubConnectionContext
type HubConnectionContext = class
Public Class HubConnectionContext
继承
HubConnectionContext

构造函数

HubConnectionContext(ConnectionContext, HubConnectionContextOptions, ILoggerFactory)

初始化 HubConnectionContext 类的新实例。

HubConnectionContext(ConnectionContext, TimeSpan, ILoggerFactory)

初始化 HubConnectionContext 类的新实例。

HubConnectionContext(ConnectionContext, TimeSpan, ILoggerFactory, TimeSpan)

初始化 HubConnectionContext 类的新实例。

属性

ConnectionAborted

获取一个 CancellationToken,它会在连接中止时发出通知。

ConnectionId

获取此连接的 ID。

Features

获取此连接上可用的功能的集合。

Items

获取可用于在此连接范围内共享数据的键/值集合。

Protocol

获取此连接使用的协议。

User

获取此连接的用户。

UserIdentifier

获取或设置此连接的用户标识符。

方法

Abort()

中止连接。

WriteAsync(HubMessage, CancellationToken)

将 写入 HubMessage 到连接。

WriteAsync(SerializedHubMessage, CancellationToken)

此方法旨在支持框架,不供应用程序代码使用。 将预序列化的消息写入连接。

扩展方法

GetHttpContext(HubConnectionContext)

从指定的连接获取HttpContextnull;如果连接未与 HTTP 请求关联,则为 。

适用于