Skip to content
mc-protocol
Esc
↑↓navigate↵open⌘Jpreview
On this page

Login Compression

Login 0x03, server → client.

login · 0x03 · clientbound (server → client)

Enables packet compression. Packets whose size is at least threshold bytes are sent zlib-compressed from this point on; a negative threshold disables compression. It may only be sent during login, before LoginFinished.

Sent by the server, read by the client. Listen for it with client.on("LoginCompression", (data) => …) on the receiving side.

Fields

Field Type Notes
threshold VarInt Minimum uncompressed packet size (ID + payload) to compress. 0: always; negative: disabled.

Send it

// Server side with autoInit: false, before LoginFinished.
await client.sendPacket("LoginCompression", { threshold: 256 });

Packets of threshold bytes or more are zlib-compressed from the next packet on, in both directions. Sending it switches this server-side client automatically. 0 compresses everything, a negative value disables compression. Do not send it after LoginFinished.

Field aliases listed under Notes are accepted as alternative keys when writing.

Source: src/Core/Versions/776/Packets/login/clientbound/LoginCompression.ts

Was this page helpful?