---
title: Disconnect
description: "Play 0x20, server → client."
---

`play` · `0x20` · **clientbound** (server → client)

Disconnects the client with the given `reason` text component. The server sends it when it kicks the player or shuts down. The client closes the connection and shows the reason on the disconnected 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

```ts
await client.sendPacket("Disconnect", {
  reason: { text: "Server restarting", color: "red" },
});
client.destroy();
```

The client shows `reason` on the disconnect screen and closes the socket. Await the send before destroying so the packet is flushed. In `login` use `LoginDisconnect`; in `config` use that state's `Disconnect`.

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

Source: [`src/Core/Versions/776/Packets/play/clientbound/Disconnect.ts`](https://github.com/GDLev/mc-protocol/blob/master/src/Core/Versions/776/Packets/play/clientbound/Disconnect.ts)
