Skip to content

VoiceGateway

Defined in: packages/voice/src/gateway.ts:58

One voice gateway WebSocket (v8). Parses JSON and binary frames, tracks the last sequence for seq_ack, and heartbeats with @lunibee/ws’s GatewayHeartbeat (an unanswered heartbeat closes with HEARTBEAT_TIMEOUT_CLOSE, which the owner resumes).

new VoiceGateway(url, handlers, options?): VoiceGateway

Defined in: packages/voice/src/gateway.ts:66

string

VoiceGatewayHandlers

VoiceSocketFactory

number

VoiceGateway

sequence: number

Defined in: packages/voice/src/gateway.ts:60

The last sequence number received, -1 before any. Sent back as seq_ack.

get ping(): number

Defined in: packages/voice/src/gateway.ts:112

Round trip of the last heartbeat, or -1.

number

close(code?, reason?): void

Defined in: packages/voice/src/gateway.ts:179

Closes the socket and stops heartbeating. A 1000 close is not reported back.

number = 1000

string = ""

void


sendBinary(op, payload): boolean

Defined in: packages/voice/src/gateway.ts:165

Sends a binary frame: the opcode byte followed by the payload.

number

Uint8Array

boolean


sendJSON(packet): boolean

Defined in: packages/voice/src/gateway.ts:154

Sends a JSON frame.

VoicePacket

boolean

Whether the socket was open.