API reference / @jsprismarine/nethernet / Reassembler
Class: Reassembler
Defined in: packages/nethernet/src/Connection.ts:77
Joins segments back into messages, in the order they arrive on the reliable channel.
Constructors
Constructor
new Reassembler(
maxBytes?):Reassembler
Defined in: packages/nethernet/src/Connection.ts:85
Parameters
maxBytes?
number = MAX_MESSAGE_BYTES
The longest message accepted, so a peer cannot make this hold more.
Returns
Reassembler
Methods
push()
push(
data):Buffer<ArrayBufferLike> |undefined
Defined in: packages/nethernet/src/Connection.ts:94
Adds one segment.
Parameters
data
Buffer
The segment, its count byte first.
Returns
Buffer<ArrayBufferLike> | undefined
The whole message once its last segment arrives, else undefined.
Throws
When the segment is empty, its count does not follow the last one, or the message grows past the limit.