tadpole/gateway/opcode
Gateway opcodes, with a safe slot for opcodes Discord adds later:
from_int never fails, unknown values land in UnknownOpcode(value)
and are ignored by the shard. Pure data; see
tadpole/gateway/frame for the envelopes that carry
these.
Types
pub type Opcode {
Dispatch
Heartbeat
Identify
PresenceUpdate
VoiceStateUpdate
Opcode5
Resume
Reconnect
RequestGuildMembers
InvalidSession
Hello
HeartbeatAck
UnknownOpcode(Int)
}
Constructors
-
Dispatch0 — receive. A dispatched event; payload in
d, name int. -
Heartbeat1 — send/receive. Heartbeat; payload is the last sequence number.
-
Identify2 — send. Authenticate and subscribe to intents.
-
PresenceUpdate3 — send. Update presence status.
-
VoiceStateUpdate4 — send. Join/move/disconnect voice channels.
-
Opcode55 — reserved, unused.
-
Resume6 — send. Resume a dropped session.
-
Reconnect7 — receive. Discord asks us to reconnect; resume afterwards.
-
RequestGuildMembers8 — send. Request guild members.
-
InvalidSession9 — receive. Invalid session;
dsays whether resume is possible. -
Hello10 — receive. First payload after connect; carries heartbeat interval.
-
HeartbeatAck11 — receive. Heartbeat acknowledgment.
-
UnknownOpcode(Int)
Values
pub fn from_int(value: Int) -> Opcode
Never fails: unknown opcodes land in UnknownOpcode instead.