Skip to content

Documents for @litert/websocket / Decl / IDecoder

Interface: IDecoder

Defined in: src/lib/Decl.ts:274

The interface of websocket message decoder.

Properties

maxMessageSize

readonly maxMessageSize: number

Defined in: src/lib/Decl.ts:279

The maximum size of a message.

Methods

decode()

decode(chunk): (IMessage | IMessageReadStream)[]

Defined in: src/lib/Decl.ts:289

Decode a chunk of data, and return the decoded messages.

If tail of the chunk is an incomplete frame, it will be buffered inside the decoder, and used in the next decode() call.

Parameters

chunk

Buffer

The chunk of data to decode.

Returns

(IMessage | IMessageReadStream)[]


reset()

reset(): void

Defined in: src/lib/Decl.ts:294

Reset the internal state of the decoder, clearing all buffered data.

Returns

void