MessagePackHubProtocol class
Implements the MessagePack Hub Protocol
Constructors
| Message |
Properties
| name | The name of the protocol. This is used by SignalR to resolve the protocol between the client and server. |
| transfer |
The TransferFormat of the protocol. |
| version | The version of the protocol. |
Methods
| parse |
Creates an array of HubMessage objects from the specified serialized representation. |
| write |
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.