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?
optionalcompressed?:boolean
Defined in: packages/prismarine/src/network/encodePacketBatch.ts:11
Whether the negotiated batch format includes a compression prefix.
Inherited from
compressionAlgorithm?
optionalcompressionAlgorithm?:PacketCompressionAlgorithm
Defined in: packages/prismarine/src/network/encodePacketBatch.ts:13
Algorithm advertised by this connection in NetworkSettings.
Inherited from
PacketBatchOptions.compressionAlgorithm
compressionLevel?
optionalcompressionLevel?: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?
optionalcompressionThreshold?: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?
optionaldirect?:boolean
Defined in: packages/prismarine/src/network/MinecraftSession.ts:882
Whether RakNet should send the framed bytes in their own datagram.
fragmentCache?
optionalfragmentCache?: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?
optionalfragmentCodec?: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?
optionalfragmentKeyDiscriminators?: readonlystring[]
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?
optionalfragmentKeys?: readonlyBuffer<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?
optionalfullFlushFragments?: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.