Skip to content

five-on-it / packages/protocol/src/snapshot-v2 / SnapshotDecoder

Class: SnapshotDecoder ​

Defined in: packages/protocol/src/snapshot-v2.ts:443

The client's side of the delta snapshots: what it holds, and every frame turned whole.

Constructors ​

Constructor ​

new SnapshotDecoder(): SnapshotDecoder

Returns ​

SnapshotDecoder

Methods ​

decode() ​

decode(bytes): DecodedFrame | undefined

Defined in: packages/protocol/src/snapshot-v2.ts:457

Decodes a binary frame: a full snapshot as it is, a delta onto what it holds (or a resync when it cannot be applied: send {"type":"resync"}); undefined for any other frame, a malformed one, or a delta while a keyframe is awaited.

Parameters ​

bytes ​

Uint8Array

Returns ​

DecodedFrame | undefined