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

Disconnect

Configuration 0x02, server → client.

config · 0x02 · clientbound (server → client)

Disconnects the client during configuration with a text component reason. The server closes the socket after sending it. The client shows the reason on the disconnect screen.

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

Fields

Field Type Notes
reason NBT

Send it

await client.sendPacket("Disconnect", {
  reason: { text: "Configuration failed", color: "red" },
});
client.disconnect();

reason is an NBT text component shown on the disconnect screen. Send the packet before closing the socket so the client receives the message.

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

Source: src/Core/Versions/776/Packets/config/clientbound/Disconnect.ts

Was this page helpful?