Skip to content

API reference / @jsprismarine/prismarine / network/MinecraftSession

network/MinecraftSession ​

Classes ​

Interfaces ​

PacketBatchSendOptions ​

Defined in: packages/prismarine/src/network/MinecraftSession.ts:880

Options for a session to frame packets as one batch.

Extends ​

Properties ​

compressed? ​

optional compressed?: boolean

Defined in: packages/prismarine/src/network/encodePacketBatch.ts:11

Whether the negotiated batch format includes a compression prefix.

Inherited from ​

PacketBatchOptions.compressed

compressionAlgorithm? ​

optional compressionAlgorithm?: PacketCompressionAlgorithm

Defined in: packages/prismarine/src/network/encodePacketBatch.ts:13

Algorithm advertised by this connection in NetworkSettings.

Inherited from ​

PacketBatchOptions.compressionAlgorithm

compressionLevel? ​

optional compressionLevel?: number

Defined in: packages/prismarine/src/network/encodePacketBatch.ts:17

zlib level for this batch; omitted to use Protocol's default.

Inherited from ​

PacketBatchOptions.compressionLevel

compressionThreshold? ​

optional compressionThreshold?: number

Defined in: packages/prismarine/src/network/encodePacketBatch.ts:15

Smallest batch payload size to compress; zero leaves every batch uncompressed.

Inherited from ​

PacketBatchOptions.compressionThreshold

direct? ​

optional direct?: boolean

Defined in: packages/prismarine/src/network/MinecraftSession.ts:882

Whether RakNet should send the framed bytes in their own datagram.

fragmentCache? ​

optional fragmentCache?: FullFlushFragmentCache

Defined in: packages/prismarine/src/network/encodePacketBatch.ts:23

Cache shared fragments for the lifetime appropriate to the caller.

Inherited from ​

PacketBatchOptions.fragmentCache

fragmentCodec? ​

optional fragmentCodec?: ProtocolCodec

Defined in: packages/prismarine/src/network/encodePacketBatch.ts:21

The protocol layout owner used as part of each fragment cache key.

Inherited from ​

PacketBatchOptions.fragmentCodec

fragmentKeyDiscriminators? ​

optional fragmentKeyDiscriminators?: readonly string[]

Defined in: packages/prismarine/src/network/encodePacketBatch.ts:27

Extra packet identity when a stable key alone does not identify the full packet.

Inherited from ​

PacketBatchOptions.fragmentKeyDiscriminators

fragmentKeys? ​

optional fragmentKeys?: readonly Buffer<ArrayBufferLike>[]

Defined in: packages/prismarine/src/network/encodePacketBatch.ts:25

Optional stable per-packet cache keys, used by serialized chunk payloads.

Inherited from ​

PacketBatchOptions.fragmentKeys

fullFlushFragments? ​

optional fullFlushFragments?: boolean

Defined in: packages/prismarine/src/network/encodePacketBatch.ts:19

Use independently compressed, reusable packet fragments for this batch.

Inherited from ​

PacketBatchOptions.fullFlushFragments

Functions ​

broadcastSharedBatches() ​

broadcastSharedBatches(sessions, packets, compressionLevel, onError, compressionThreshold?, fragmentOptions?): Promise<void>

Defined in: packages/prismarine/src/network/MinecraftSession.ts:815

Fans one packet out as shared batches, compressed once per protocol codec.

The shared-batch win - one deflate serving every recipient - used to be one global batch, which handed a 2225 session the 2193 layout for any packet whose wire changed between them. Sessions are grouped by codec and each group gets bytes encoded under its own: the single compression survives within a group, and a mixed-version audience each receives its negotiated layout. A group whose encode fails is logged and skipped; the others still send.

Parameters ​

sessions ​

readonly MinecraftSession[]

Who receives it.

packets ​

NetworkPacket<unknown> | readonly NetworkPacket<unknown>[]

The packets, as the caller built them.

compressionLevel ​

number

The batch compression level.

onError ​

(error) => void

Where an encode failure goes.

compressionThreshold? ​

number

Optional override for the minimum batch-body size to compress.

fragmentOptions? ​

Pick<PacketBatchOptions, "fullFlushFragments" | "fragmentCache"> = {}

Returns ​

Promise<void>


debugPacketNames() ​

debugPacketNames(value): ReadonlySet<string>

Defined in: packages/prismarine/src/network/MinecraftSession.ts:37

The packet class names a debugging variable lists, comma-separated.

Two variables use this. JSP_DEBUG_DROP_PACKETS names clientbound packets that never reach the wire, which bisects a join stream one packet type at a time against a client that leaves without saying why. JSP_DEBUG_DUMP_PACKETS names packets whose encoded bytes are written to a file, one per packet, so what a real client was given can be decoded offline. Both leave a warn line per packet. Read when a session is created, from the environment the server was started with.

Parameters ​

value ​

string | undefined

The variable's value.

Returns ​

ReadonlySet<string>

The names listed, empty when the variable is unset.