Keep Alive (clientbound)
Configuration 0x04, server → client.
config · 0x04 · clientbound (server → client)
Keep-alive during configuration. The server sends a random keepAliveId and the client must echo it back in its own KeepAlive within the timeout, or it is disconnected.
Sent by the server, read by the client. Listen for it with client.on("KeepAlive", (data) => …) on the receiving side.
Fields
| Field | Type | Notes |
|---|---|---|
keepAliveId |
Long | also id |
Send it
// Server side, while the connection remains in configuration.
const keepAliveId = BigInt(Date.now());
await client.sendPacket("KeepAlive", { keepAliveId });
Keep the ID until the client returns a serverbound KeepAlive with the same value. keepAliveId is signed 64-bit; id is accepted as an alias.
Field aliases listed under Notes are accepted as alternative keys when writing.
Source: src/Core/Versions/776/Packets/config/clientbound/KeepAlive.ts