Expand description
Discord Gateway WebSocket client.
Protocol flow: connect → HELLO → IDENTIFY (or RESUME) → READY → event loop.
On disconnect:
- If we have a stored session_id + last_seq, attempt RESUME using the
resume_gateway_urlfrom the prior READY payload. - On INVALID_SESSION(resumable=false) or RECONNECT, drop session and re-IDENTIFY.
Heartbeat:
- HELLO provides
heartbeat_intervalin milliseconds. - We send HEARTBEAT every interval, tracking ACK. If the prior heartbeat was not ACK’d, the connection is a zombie — close and reconnect.
Structs§
- Session 🔒
Constants§
Functions§
- handle_
dispatch 🔒 - run_
gateway_ loop - run_
session 🔒 - Run a single Gateway session. Returns: Ok(Some(session)) — clean disconnect, can attempt RESUME Ok(None) — clean disconnect, session is invalid (re-IDENTIFY) Err(e) — unexpected error, will re-IDENTIFY after backoff
- unix_
secs 🔒