#[non_exhaustive]#[repr(u8)]pub enum OpCode {
Dispatch = 0,
Heartbeat = 1,
Identify = 2,
PresenceUpdate = 3,
VoiceStateUpdate = 4,
Resume = 6,
Reconnect = 7,
RequestGuildMembers = 8,
InvalidSession = 9,
Hello = 10,
HeartbeatAck = 11,
}
Expand description
Gateway event’s payload type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Dispatch = 0
DispatchEvent
and sequence number.
Will only be received when connected to the gateway with an active session.
Heartbeat = 1
Periodically sent to maintain the gateway connection and may be received to immediately request one.
Identify = 2
Start a new session.
PresenceUpdate = 3
Request to update the client’s presence.
VoiceStateUpdate = 4
Request to join, leave or move between voice channels.
Resume = 6
Resume a previously disconnected session, skipping over Identify
.
Reconnect = 7
Indicates that a reconnect is required.
RequestGuildMembers = 8
Request a list of members for a guild.
InvalidSession = 9
Received when the session is invalidated.
Hello = 10
Received after connecting, contains the heartbeat interval.
HeartbeatAck = 11
Received in response to sending a Heartbeat
.
Implementations§
Source§impl OpCode
impl OpCode
Sourcepub const fn from(code: u8) -> Option<Self>
pub const fn from(code: u8) -> Option<Self>
Try to match an integer value to an opcode, returning None
if no
match is found.
Sourcepub const fn is_received(self) -> bool
pub const fn is_received(self) -> bool
Whether the opcode is received by the client.
This includes the following opcodes: