IHubProtocol interface

A protocol abstraction for communicating with SignalR Hubs.

Properties

name

The name of the protocol. This is used by SignalR to resolve the protocol between the client and server.

transferFormat

The TransferFormat of the protocol.

version

The version of the protocol.

Methods

parseMessages

Creates an array of HubMessage objects from the specified serialized representation. If transferFormat is 'Text', the input parameter must be a string, otherwise it must be an ArrayBuffer.

writeMessage

Writes the specified HubMessage to a string or ArrayBuffer and returns it. If transferFormat is 'Text', the result of this method will be a string, otherwise it will be an ArrayBuffer.

Property Details

name

The name of the protocol. This is used by SignalR to resolve the protocol between the client and server.

name: string

Property Value

transferFormat

The TransferFormat of the protocol.

transferFormat: TransferFormat

Property Value

version

The version of the protocol.

version: number

Property Value

Method Details

parseMessages

Creates an array of HubMessage objects from the specified serialized representation. If transferFormat is 'Text', the input parameter must be a string, otherwise it must be an ArrayBuffer.

function parseMessages(input: string | ArrayBuffer, logger: ILogger)

Parameters

input
string | ArrayBuffer

A string, or ArrayBuffer containing the serialized representation.

logger
ILogger

A logger that will be used to log messages that occur during parsing.

Returns

writeMessage

Writes the specified HubMessage to a string or ArrayBuffer and returns it. If transferFormat is 'Text', the result of this method will be a string, otherwise it will be an ArrayBuffer.

function writeMessage(message: HubMessage)

Parameters

message
HubMessage

The message to write.

Returns

string | ArrayBuffer