Skip to content

API reference / @jsprismarine/prismarine / network/InboundPacketTrace / InboundPacketTrace

Class: InboundPacketTrace ​

Defined in: prismarine/src/network/InboundPacketTrace.ts:37

A process-local trace that copies packet bytes and can report or serialize its storage cost.

Packet bytes may include identity or login data. Capture is opt-in, and the caller owns the trace's storage, access control, and retention.

Implements ​

Constructors ​

Constructor ​

new InboundPacketTrace(): InboundPacketTrace

Returns ​

InboundPacketTrace

Methods ​

getPayloadBytes() ​

getPayloadBytes(): number

Defined in: prismarine/src/network/InboundPacketTrace.ts:54

The number of captured packet payload bytes, without object or encoding overhead.

Returns ​

number


packetDigestsByTick() ​

packetDigestsByTick(): ReadonlyMap<number, string>

Defined in: prismarine/src/network/InboundPacketTrace.ts:59

Hashes accepted inbound packet records per arrival tick, in captured order.

Returns ​

ReadonlyMap<number, string>


record() ​

record(packet): void

Defined in: prismarine/src/network/InboundPacketTrace.ts:41

Adds a private copy of the accepted packet bytes to this trace.

Parameters ​

packet ​

InboundPacketRecord

Returns ​

void

Implementation of ​

InboundPacketRecorder.record


records() ​

records(): readonly InboundPacketRecord[]

Defined in: prismarine/src/network/InboundPacketTrace.ts:49

Returns trace records in recorder-call order with independent packet buffers.

Returns ​

readonly InboundPacketRecord[]


serialize() ​

serialize(): Buffer

Defined in: prismarine/src/network/InboundPacketTrace.ts:83

Serializes the trace as UTF-8 JSON, with packet bytes encoded as Base64.

Returns ​

Buffer


deserialize() ​

static deserialize(bytes): InboundPacketTrace

Defined in: prismarine/src/network/InboundPacketTrace.ts:107

Parses a trace written by InboundPacketTrace.serialize.

Parameters ​

bytes ​

Uint8Array

Returns ​

InboundPacketTrace

Throws ​

When the format, version, or any record field is invalid.