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).
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new VoiceGateway(
url,handlers,options?):VoiceGateway
Defined in: packages/voice/src/gateway.ts:66
Parameters
Section titled “Parameters”string
handlers
Section titled “handlers”options?
Section titled “options?”factory?
Section titled “factory?”sequence?
Section titled “sequence?”number
Returns
Section titled “Returns”VoiceGateway
Properties
Section titled “Properties”sequence
Section titled “sequence”sequence:
number
Defined in: packages/voice/src/gateway.ts:60
The last sequence number received, -1 before any. Sent back as seq_ack.
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get ping():
number
Defined in: packages/voice/src/gateway.ts:112
Round trip of the last heartbeat, or -1.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”close()
Section titled “close()”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.
Parameters
Section titled “Parameters”number = 1000
reason?
Section titled “reason?”string = ""
Returns
Section titled “Returns”void
sendBinary()
Section titled “sendBinary()”sendBinary(
op,payload):boolean
Defined in: packages/voice/src/gateway.ts:165
Sends a binary frame: the opcode byte followed by the payload.
Parameters
Section titled “Parameters”number
payload
Section titled “payload”Uint8Array
Returns
Section titled “Returns”boolean
sendJSON()
Section titled “sendJSON()”sendJSON(
packet):boolean
Defined in: packages/voice/src/gateway.ts:154
Sends a JSON frame.
Parameters
Section titled “Parameters”packet
Section titled “packet”Returns
Section titled “Returns”boolean
Whether the socket was open.