Skip to main content

Class: ChatMessage

protocol.ChatMessage

Represents a ChatMessage.

Implements

Constructors

constructor

new ChatMessage(properties?): ChatMessage

Constructs a new ChatMessage.

Parameters

NameTypeDescription
properties?IChatMessageProperties to set

Returns

ChatMessage

Properties

body

body: string

ChatMessage body.

Implementation of

IChatMessage.body


sender

sender: string

ChatMessage sender.

Implementation of

IChatMessage.sender


type

type: string

ChatMessage type.

Implementation of

IChatMessage.type

Methods

create

create(properties?): ChatMessage

Creates a new ChatMessage instance using the specified properties.

Parameters

NameTypeDescription
properties?IChatMessageProperties to set

Returns

ChatMessage

ChatMessage instance


decode

decode(reader, length?): ChatMessage

Decodes a ChatMessage message from the specified reader or buffer.

Parameters

NameTypeDescription
readerReader | Uint8ArrayReader or buffer to decode from
length?numberMessage length if known beforehand

Returns

ChatMessage

ChatMessage

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): ChatMessage

Decodes a ChatMessage message from the specified reader or buffer, length delimited.

Parameters

NameTypeDescription
readerReader | Uint8ArrayReader or buffer to decode from

Returns

ChatMessage

ChatMessage

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


encode

encode(message, writer?): Writer

Encodes the specified ChatMessage message. Does not implicitly verify messages.

Parameters

NameTypeDescription
messageIChatMessageChatMessage message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

Encodes the specified ChatMessage message, length delimited. Does not implicitly verify messages.

Parameters

NameTypeDescription
messageIChatMessageChatMessage message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


fromObject

fromObject(object): ChatMessage

Creates a ChatMessage message from a plain object. Also converts values to their respective internal types.

Parameters

NameTypeDescription
objectObjectPlain object

Returns

ChatMessage

ChatMessage


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for ChatMessage

Parameters

NameTypeDescription
typeUrlPrefix?stringyour custom typeUrlPrefix(default "type.googleapis.com")

Returns

string

The default type url


toJSON

toJSON(): Object

Converts this ChatMessage to JSON.

Returns

Object

JSON object


toObject

toObject(message, options?): Object

Creates a plain object from a ChatMessage message. Also converts values to other types if specified.

Parameters

NameTypeDescription
messageChatMessageChatMessage
options?IConversionOptionsConversion options

Returns

Object

Plain object


verify

verify(message): string

Verifies a ChatMessage message.

Parameters

NameTypeDescription
messageObjectPlain object to verify

Returns

string

null if valid, otherwise the reason why it is not