GatewayAction
GatewayAction = {
heartbeatInterval:number;type:"hello"; } | {data:unknown;event:string|null;type:"dispatch"; } | {type:"heartbeat"; } | {data:unknown;type:"heartbeat-ack"; } | {type:"reconnect"; } | {resumable:boolean;type:"invalid-session"; } | {opcode:number;type:"unknown"; } | {cause?:unknown;message:string;type:"invalid";violation:ProtocolViolation; }
Defined in: packages/ws/src/protocol.ts:24
What a received frame means.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ heartbeatInterval: number; type: "hello"; }
op 10: begin heartbeating and hand shake.
Type Literal
Section titled “Type Literal”{ data: unknown; event: string | null; type: "dispatch"; }
op 0: an event. event is null only if Discord omitted t.
Type Literal
Section titled “Type Literal”{ type: "heartbeat"; }
op 1: Discord asks for a heartbeat now.
Type Literal
Section titled “Type Literal”{ data: unknown; type: "heartbeat-ack"; }
op 11: the last heartbeat was acknowledged.
Type Literal
Section titled “Type Literal”{ type: "reconnect"; }
op 7: Discord asks the client to reconnect.
Type Literal
Section titled “Type Literal”{ resumable: boolean; type: "invalid-session"; }
op 9: the session is gone. resumable decides RESUME vs IDENTIFY.
Type Literal
Section titled “Type Literal”{ opcode: number; type: "unknown"; }
An opcode this version does not handle.
Ignored rather than treated as an error: Discord adds opcodes, and a client that fails on an unfamiliar one breaks itself on every addition.
Type Literal
Section titled “Type Literal”{ cause?: unknown; message: string; type: "invalid"; violation: ProtocolViolation; }
The frame was malformed. Never silently swallowed.