Skip to main content
Version: 6.1.x

Opcodes

Everything that will be sent through the Gateway has it's own Opcode, so everyone knows what is going to be sent and recieved.

Gateway Opcodes​

CODENAMESENT BYDESCRIPTION
-1ErrorGatewaySomething went completely wrong. Just reconnect.
0EventGatewayAn Event sent by the Gateway.
1EventClientAn Event sent by the Client.
5HelloGatewaySent after Connecting. Has the heartbeat as parameter.
10HeartbeatClientSent by the Client to keep the connection alive.
11Heartbeat ACKGatewayAcknowledges the Heartbeat from the Client.

Opcode specification​

Error​

The Error Opcode gets sent, if something went wrong. You will recieve a special Error code, a describing message and sometimes an array with error messages, as well as an array with the objects you've sent, ordered by the error messages.

Example Payload

{
"op": -1,
"e": 4005,
"d": {
"errors": [
"Type not provided.",
"Key not provided."
],
"data": [
null,
null
]
},
"m": "Malformed data."
}

Event from the Gatway​

An Event was emited from the Gateway to the Client. You will recieve the Event Name, as well as the data for the specific Event.

Example Payload

{
"op": 0,
"d": {
"guilds": 1000,
"guildMembers": 55555,
"cachedGuildMembers": 32000
},
"t": "GLOBAL_GUILD_COUNT"
}

Event from the Client​

An Event was emited from the Client to the Gateway. You will recieve the Event Name, as well as the data for the specific Event.

Example Payload -> see here

Hello​

After Connecting, you will recieve this Hello Payload. It contains important information for your Heartbeat.

Example Payload -> see here

Heartbeat​

A Hearbeat payload just containts the opcode. No additional data should be sent.

Example Payload

{
"op": 10
}

Heartbeat ACK​

After sending a Heartbeat Packet, you (should (in the best case (i really really hope))) recieve this ACK. If not, please reconnect to the Gateway.

Example Payload -> see here