five-on-it / packages/protocol/src/snapshot-reader / SnapshotReader
Class: SnapshotReader
Defined in: packages/protocol/src/snapshot-reader.ts:62
Reads every snapshot frame a client gets, of any kind, into the snapshots it shows (see the module documentation).
Constructors
Constructor
new SnapshotReader():
SnapshotReader
Returns
SnapshotReader
Properties
stats
readonlystats:ReaderStats
Defined in: packages/protocol/src/snapshot-reader.ts:70
What the reader has made of the frames so far.
Accessors
ack
Get Signature
get ack():
number
Defined in: packages/protocol/src/snapshot-reader.ts:73
The newest snapshot tick shown: what the client acknowledges (0 before any).
Returns
number
framesHeld
Get Signature
get framesHeld():
number
Defined in: packages/protocol/src/snapshot-reader.ts:83
How many acked states the reader keeps (at most HELD_RING).
Returns
number
kind
Get Signature
get kind():
SnapshotMode|undefined
Defined in: packages/protocol/src/snapshot-reader.ts:78
The kind of the frames shown last; undefined before the first.
Returns
SnapshotMode | undefined
Methods
read()
read(
bytes):ReadFrame|undefined
Defined in: packages/protocol/src/snapshot-reader.ts:88
Reads one binary frame: a snapshot to show, a request for a keyframe, or nothing (any other frame, a stale one, one dropped).
Parameters
bytes
Uint8Array
Returns
ReadFrame | undefined