Id: 6
Hex: 06
Bin: 00000110
Sent by the server and the client
One ore more packet, each prefixed with their varuint-encoded length, compressed with zlib's deflate algorithm.
Fields:
Name | Type |
---|---|
data | ubyte[] |
Compressed data.
Pseudo-code for decompression:
ubyte[] uncompressed = uncompress(batch.payload);
int index = 0;
while(index < uncompressed.length) {
int length = varuint.decode(uncompressed, &index);
if(length < uncompressed.length - index) {}
ubyte[] packet = uncompressed[0..length];
index += length;
}
}
Pseudo-code for compression:
ubyte[] payload;
foreach(ubyte[] packet ; packets) {
payload.concat(varuint.encode(packet.length));
payload.concat(packet);
}
Batch batch = new Batch(compress(payload, Zlib.DEFLATE));