Share via


MessagePackHubProtocol class

Implements the MessagePack Hub Protocol

Constructors

MessagePackHubProtocol(MessagePackOptions)

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(ArrayBuffer, ILogger)

Creates an array of HubMessage objects from the specified serialized representation.

writeMessage(HubMessage)

Writes the specified HubMessage to an ArrayBuffer and returns it.

Constructor Details

MessagePackHubProtocol(MessagePackOptions)

new MessagePackHubProtocol(messagePackOptions?: MessagePackOptions)

Parameters

messagePackOptions
MessagePackOptions

MessagePack options passed to @msgpack/msgpack

Property Details

name

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

public name: string = "messagepack"

Property Value

string

transferFormat

The TransferFormat of the protocol.

public transferFormat: TransferFormat = TransferFormat.Binary

Property Value

TransferFormat

version

The version of the protocol.

public version: number = 1

Property Value

number

Method Details

parseMessages(ArrayBuffer, ILogger)

Creates an array of HubMessage objects from the specified serialized representation.

function parseMessages(input: ArrayBuffer, logger: ILogger): HubMessage[]

Parameters

input

ArrayBuffer

An ArrayBuffer containing the serialized representation.

logger

ILogger

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

Returns

HubMessage[]

writeMessage(HubMessage)

Writes the specified HubMessage to an ArrayBuffer and returns it.

function writeMessage(message: HubMessage): ArrayBuffer

Parameters

message

HubMessage

The message to write.

Returns

ArrayBuffer

An ArrayBuffer containing the serialized representation of the message.