JsonHubProtocol class

Implements the JSON Hub Protocol.

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

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

writeMessage(HubMessage)

Writes the specified HubMessage to a string and returns it.

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 = JSON_HUB_PROTOCOL_NAME

Property Value

string

transferFormat

The TransferFormat of the protocol.

public transferFormat: TransferFormat = TransferFormat.Text

Property Value

version

The version of the protocol.

public version: number = 1

Property Value

number

Method Details

parseMessages(string, ILogger)

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

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

Parameters

input

string

A string containing the serialized representation.

logger
ILogger

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

Returns

writeMessage(HubMessage)

Writes the specified HubMessage to a string and returns it.

function writeMessage(message: HubMessage): string

Parameters

message
HubMessage

The message to write.

Returns

string

A string containing the serialized representation of the message.