Class: Message

Message

Abstract runtime message.

new Message(properties)

Constructs a new message instance.

Name Type Description
properties Properties.<T> optional

Properties to set

Members

Message.$type readonly{ Type }

Reference to the reflected type.

$type readonly{ Type }

Reference to the reflected type.

Methods

Message.create(properties){ Message.<T> }

Creates a new message of this type using the specified properties.

This:
Name Type Description
properties Object.<string, *> optional

Properties to set

Returns:
Type Description
Message.<T> Message instance

Message.decode(reader){ T }

Decodes a message of this type.

This:
Name Type Description
reader Reader | Uint8Array

Reader or buffer to decode

Returns:
Type Description
T Decoded message

Message.decodeDelimited(reader){ T }

Decodes a message of this type preceeded by its length as a varint.

This:
Name Type Description
reader Reader | Uint8Array

Reader or buffer to decode

Returns:
Type Description
T Decoded message

Message.encode(message, writer){ Writer }

Encodes a message of this type.

This:
Name Type Description
message T | Object.<string, *>

Message to encode

writer Writer optional

Writer to use

Returns:
Type Description
Writer Writer

Message.encodeDelimited(message, writer){ Writer }

Encodes a message of this type preceeded by its length as a varint.

This:
Name Type Description
message T | Object.<string, *>

Message to encode

writer Writer optional

Writer to use

Returns:
Type Description
Writer Writer

Message.fromObject(object){ T }

Creates a new message of this type from a plain object. Also converts values to their respective internal types.

This:
Name Type Description
object Object.<string, *>

Plain object

Returns:
Type Description
T Message instance

Message.toObject(message, options){ Object<string, *> }

Creates a plain object from a message of this type. Also converts values to other types if specified.

This:
Name Type Description
message T

Message instance

options IConversionOptions optional

Conversion options

Returns:
Type Description
Object.<string, *> Plain object

Message.verify(message){ string | null }

Verifies a message of this type.

Name Type Description
message Object.<string, *>

Plain object to verify

Returns:
Type Description
string | null null if valid, otherwise the reason why it is not

toJSON(){ Object<string, *> }

Converts this message to JSON.

Returns:
Type Description
Object.<string, *> JSON object