OpEnum
: int
in package
Contains constants used in websockets.
Tags
Table of Contents
Cases
- CLOSE_ABNORMAL = 1006
- Abnormal close.
- CLOSE_DISALLOWED_INTENTS = 4014
- Disallowed intents.
- CLOSE_INVALID_INTENTS = 4013
- Invalid intents.
- CLOSE_INVALID_MESSAGE = 4002
- Invalid message was sent.
- CLOSE_INVALID_OPCODE = 4001
- Unknown opcode was sent.
- CLOSE_INVALID_SEQ = 4007
- Invalid RESUME sequence.
- CLOSE_INVALID_SESSION = 4006
- Session is invalid.
- CLOSE_INVALID_SHARD = 4010
- Invalid shard.
- CLOSE_INVALID_TOKEN = 4004
- Invalid token on IDENTIFY.
- CLOSE_INVALID_VERSION = 4012
- Invalid API version.
- CLOSE_NORMAL = 1000
- Normal close or heartbeat is invalid.
- CLOSE_NOT_AUTHENTICATED = 4003
- Not authenticated.
- CLOSE_SESSION_TIMEOUT = 4009
- Session timeout.
- CLOSE_SHARDING_REQUIRED = 4011
- Sharding required.
- CLOSE_TOO_MANY_MSG = 4008
- Too many messages sent.
- CLOSE_UNKNOWN_ERROR = 4000
- Unknown error.
- CLOSE_VOICE_DISCONNECTED = 4014
- Disconnected from channel.
- CLOSE_VOICE_SERVER_CRASH = 4015
- Voice server crashed.
- CLOSE_VOICE_SERVER_NOT_FOUND = 4011
- Can't find the server.
- CLOSE_VOICE_UNKNOWN_ENCRYPT = 4016
- Unknown encryption mode.
- CLOSE_VOICE_UNKNOWN_PROTO = 4012
- Unknown protocol.
- CONST_ALREADY_AUTHD = 4005
- Already authenticated.
- OP_DISPATCH = 0
- Dispatches an event.
- OP_GUILD_MEMBER_CHUNK = 8
- Used to request member chunks.
- OP_HEARTBEAT = 1
- Used for ping checking.
- OP_HEARTBEAT_ACK = 11
- Used to acknowledge heartbeats.
- OP_HELLO = 10
- Used to pass through the heartbeat interval.
- OP_IDENTIFY = 2
- Used for client handshake.
- OP_INVALID_SESSION = 9
- Used to notify clients when they have an invalid session.
- OP_PRESENCE_UPDATE = 3
- Used to update the client presence.
- OP_RECONNECT = 7
- Used to redirect clients to a new gateway.
- OP_REQUEST_SOUNDBOARD_SOUNDS = 31
- Request soundboard sounds.
- OP_RESUME = 6
- Used to resume a closed connection.
- OP_VOICE_SERVER_PING = 5
- Used for voice ping checking.
- OP_VOICE_STATE_UPDATE = 4
- Used to join/move/leave voice channels.
- VOICE_CLIENT_CONNECT = 11
- VOICE_CLIENT_DISCONNECT = 13
- A client has disconnected from the voice channel.
- VOICE_CLIENT_PLATFORM = 20
- NOT DOCUMENTED - Assumed to be the platform type in which the user is.
- VOICE_CLIENT_UNKNOWN_15 = 15
- Was not documented within the op codes and statuses
- VOICE_CLIENT_UNKNOWN_18 = 18
- VOICE_CLIENTS_CONNECT = 11
- One or more clients have connected to the voice channel
- VOICE_DAVE_EXECUTE_TRANSITION = 22
- Execute a previously announced protocol transition.
- VOICE_DAVE_MLS_ANNOUNCE_COMMIT_TRANSITION = 29
- MLS Commit to be processed for upcoming transition.
- VOICE_DAVE_MLS_COMMIT_WELCOME = 28
- MLS Commit with optional MLS Welcome messages.
- VOICE_DAVE_MLS_EXTERNAL_SENDER = 25
- Credential and public key for MLS external sender.
- VOICE_DAVE_MLS_INVALID_COMMIT_WELCOME = 31
- Flag invalid commit or welcome, request re-add
- VOICE_DAVE_MLS_KEY_PACKAGE = 26
- MLS Key Package for pending group member.
- VOICE_DAVE_MLS_PROPOSALS = 27
- MLS Proposals to be appended or revoked.
- VOICE_DAVE_MLS_WELCOME = 30
- MLS Welcome to group for upcoming transition.
- VOICE_DAVE_PREPARE_EPOCH = 24
- A DAVE protocol version or group change is upcoming.
- VOICE_DAVE_PREPARE_TRANSITION = 21
- A downgrade from the DAVE protocol is upcoming.
- VOICE_DAVE_TRANSITION_READY = 23
- Acknowledge readiness previously announced transition.
- VOICE_DESCRIPTION = 4
- Used to describe the session.
- VOICE_HEARTBEAT = 3
- Used to keep the WebSocket connection alive.
- VOICE_HEARTBEAT_ACK = 6
- Sent by the Discord servers to acknowledge heartbeat
- VOICE_HELLO = 8
- Hello packet used to pass heartbeat interval
- VOICE_IDENTIFY = 0
- Used to begin a voice WebSocket connection.
- VOICE_READY = 2
- Used to complete the WebSocket handshake.
- VOICE_RESUME = 7
- Resume a connection.
- VOICE_RESUMED = 9
- Acknowledge a successful session resume.
- VOICE_SELECT_PROTO = 1
- Used to select the voice protocol.
- VOICE_SPEAKING = 5
- Used to identify which users are speaking.
Methods
- getAllCodes() : array<string|int, int>
- Returns every valid gateway and voice opcode.
- getCriticalCloseCodes() : array<string|int, mixed>
- Returns the critical event codes that we should not reconnect after.
- getCriticalVoiceCloseCodes() : array<string|int, mixed>
- Returns the critical event codes for a voice websocket.
- getGatewayCodes() : array<string|int, int>
- Returns every valid main-gateway opcode.
- getVoiceCodes() : array<string|int, int>
- Returns every valid voice-gateway opcode.
- isCriticalCloseCode() : bool
- Whether `$code` is a non-recoverable main-gateway close code.
- isCriticalVoiceCloseCode() : bool
- Whether `$code` is a non-recoverable voice-gateway close code.
- isGatewayCode() : bool
- Whether `$code` is a main-gateway opcode.
- isValidCloseCode() : bool
- Whether `$code` is a known critical close code (gateway or voice).
- isValidCode() : bool
- Whether `$code` is any known gateway or voice opcode.
- isValidOp() : bool
- Whether `$code` is any known opcode or critical close code.
- isValidOpCode() : bool
- Whether `$code` is a gateway or voice opcode.
- isVoiceCode() : bool
- Whether `$code` is a voice-gateway opcode.
- voiceCodeToString() : string
- Renders a voice opcode as its constant name.
Cases
OP_DISPATCH
Dispatches an event.
OP_HEARTBEAT
Used for ping checking.
OP_IDENTIFY
Used for client handshake.
OP_PRESENCE_UPDATE
Used to update the client presence.
OP_VOICE_STATE_UPDATE
Used to join/move/leave voice channels.
OP_VOICE_SERVER_PING
Used for voice ping checking.
OP_RESUME
Used to resume a closed connection.
OP_RECONNECT
Used to redirect clients to a new gateway.
OP_GUILD_MEMBER_CHUNK
Used to request member chunks.
OP_INVALID_SESSION
Used to notify clients when they have an invalid session.
OP_HELLO
Used to pass through the heartbeat interval.
OP_HEARTBEAT_ACK
Used to acknowledge heartbeats.
OP_REQUEST_SOUNDBOARD_SOUNDS
Request soundboard sounds.
VOICE_IDENTIFY
Used to begin a voice WebSocket connection.
VOICE_SELECT_PROTO
Used to select the voice protocol.
VOICE_READY
Used to complete the WebSocket handshake.
VOICE_HEARTBEAT
Used to keep the WebSocket connection alive.
VOICE_DESCRIPTION
Used to describe the session.
VOICE_SPEAKING
Used to identify which users are speaking.
VOICE_HEARTBEAT_ACK
Sent by the Discord servers to acknowledge heartbeat
VOICE_RESUME
Resume a connection.
VOICE_HELLO
Hello packet used to pass heartbeat interval
VOICE_RESUMED
Acknowledge a successful session resume.
VOICE_CLIENTS_CONNECT
One or more clients have connected to the voice channel
VOICE_CLIENT_CONNECT
VOICE_CLIENT_DISCONNECT
A client has disconnected from the voice channel.
VOICE_CLIENT_UNKNOWN_15
Was not documented within the op codes and statuses
VOICE_CLIENT_UNKNOWN_18
VOICE_CLIENT_PLATFORM
NOT DOCUMENTED - Assumed to be the platform type in which the user is.
VOICE_DAVE_PREPARE_TRANSITION
A downgrade from the DAVE protocol is upcoming.
VOICE_DAVE_EXECUTE_TRANSITION
Execute a previously announced protocol transition.
VOICE_DAVE_TRANSITION_READY
Acknowledge readiness previously announced transition.
VOICE_DAVE_PREPARE_EPOCH
A DAVE protocol version or group change is upcoming.
VOICE_DAVE_MLS_EXTERNAL_SENDER
Credential and public key for MLS external sender.
VOICE_DAVE_MLS_KEY_PACKAGE
MLS Key Package for pending group member.
VOICE_DAVE_MLS_PROPOSALS
MLS Proposals to be appended or revoked.
VOICE_DAVE_MLS_COMMIT_WELCOME
MLS Commit with optional MLS Welcome messages.
VOICE_DAVE_MLS_ANNOUNCE_COMMIT_TRANSITION
MLS Commit to be processed for upcoming transition.
VOICE_DAVE_MLS_WELCOME
MLS Welcome to group for upcoming transition.
VOICE_DAVE_MLS_INVALID_COMMIT_WELCOME
Flag invalid commit or welcome, request re-add
CLOSE_NORMAL
Normal close or heartbeat is invalid.
CLOSE_ABNORMAL
Abnormal close.
CLOSE_UNKNOWN_ERROR
Unknown error.
CLOSE_INVALID_OPCODE
Unknown opcode was sent.
CLOSE_INVALID_MESSAGE
Invalid message was sent.
CLOSE_NOT_AUTHENTICATED
Not authenticated.
CLOSE_INVALID_TOKEN
Invalid token on IDENTIFY.
CONST_ALREADY_AUTHD
Already authenticated.
CLOSE_INVALID_SESSION
Session is invalid.
CLOSE_INVALID_SEQ
Invalid RESUME sequence.
CLOSE_TOO_MANY_MSG
Too many messages sent.
CLOSE_SESSION_TIMEOUT
Session timeout.
CLOSE_INVALID_SHARD
Invalid shard.
CLOSE_SHARDING_REQUIRED
Sharding required.
CLOSE_INVALID_VERSION
Invalid API version.
CLOSE_INVALID_INTENTS
Invalid intents.
CLOSE_DISALLOWED_INTENTS
Disallowed intents.
CLOSE_VOICE_SERVER_NOT_FOUND
Can't find the server.
CLOSE_VOICE_UNKNOWN_PROTO
Unknown protocol.
CLOSE_VOICE_DISCONNECTED
Disconnected from channel.
CLOSE_VOICE_SERVER_CRASH
Voice server crashed.
CLOSE_VOICE_UNKNOWN_ENCRYPT
Unknown encryption mode.
Methods
getAllCodes()
Returns every valid gateway and voice opcode.
public
static getAllCodes() : array<string|int, int>
Return values
array<string|int, int>getCriticalCloseCodes()
Returns the critical event codes that we should not reconnect after.
public
static getCriticalCloseCodes() : array<string|int, mixed>
Return values
array<string|int, mixed>getCriticalVoiceCloseCodes()
Returns the critical event codes for a voice websocket.
public
static getCriticalVoiceCloseCodes() : array<string|int, mixed>
Return values
array<string|int, mixed>getGatewayCodes()
Returns every valid main-gateway opcode.
public
static getGatewayCodes() : array<string|int, int>
Return values
array<string|int, int>getVoiceCodes()
Returns every valid voice-gateway opcode.
public
static getVoiceCodes() : array<string|int, int>
Return values
array<string|int, int>isCriticalCloseCode()
Whether `$code` is a non-recoverable main-gateway close code.
public
static isCriticalCloseCode(int $code) : bool
Parameters
- $code : int
Return values
boolisCriticalVoiceCloseCode()
Whether `$code` is a non-recoverable voice-gateway close code.
public
static isCriticalVoiceCloseCode(int $code) : bool
Parameters
- $code : int
Return values
boolisGatewayCode()
Whether `$code` is a main-gateway opcode.
public
static isGatewayCode(int $code) : bool
Parameters
- $code : int
Return values
boolisValidCloseCode()
Whether `$code` is a known critical close code (gateway or voice).
public
static isValidCloseCode(int $code) : bool
Parameters
- $code : int
Return values
boolisValidCode()
Whether `$code` is any known gateway or voice opcode.
public
static isValidCode(int $code) : bool
Parameters
- $code : int
Return values
boolisValidOp()
Whether `$code` is any known opcode or critical close code.
public
static isValidOp(int $code) : bool
Parameters
- $code : int
Return values
boolisValidOpCode()
Whether `$code` is a gateway or voice opcode.
public
static isValidOpCode(int $code) : bool
Parameters
- $code : int
Return values
boolisVoiceCode()
Whether `$code` is a voice-gateway opcode.
public
static isVoiceCode(int $code) : bool
Parameters
- $code : int
Return values
boolvoiceCodeToString()
Renders a voice opcode as its constant name.
public
static voiceCodeToString([self|null $code = null ][, bool $snakeCase = false ][, bool $pluckVoicePrefix = true ]) : string
Parameters
- $code : self|null = null
-
The opcode (or its int value); defaults to null.
- $snakeCase : bool = false
-
Return
snake_caserather thanSCREAMING_CASE. - $pluckVoicePrefix : bool = true
-
Strip the leading
VOICE_prefix.
Return values
string —The rendered name, or an empty string when $code is not a voice opcode.