VoiceNetworking
Defined in: packages/voice/src/networking.ts:89
One voice server session: the voice gateway handshake (v8), IP discovery, transport encryption, DAVE, and sending and receiving RTP packets. A new server (VOICE_SERVER_UPDATE) needs a new instance; a recoverable close (network loss, voice server crash) resumes on its own.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new VoiceNetworking(
info,handlers?,options?):VoiceNetworking
Defined in: packages/voice/src/networking.ts:114
Parameters
Section titled “Parameters”handlers?
Section titled “handlers?”options?
Section titled “options?”Returns
Section titled “Returns”VoiceNetworking
Properties
Section titled “Properties”
optionalmode?:VoiceEncryptionMode
Defined in: packages/voice/src/networking.ts:94
The negotiated encryption mode, once ready.
ssrc:
number=0
Defined in: packages/voice/src/networking.ts:92
Our SSRC, from READY.
state:
NetworkingState="opening"
Defined in: packages/voice/src/networking.ts:90
Accessors
Section titled “Accessors”connectedUsers
Section titled “connectedUsers”Get Signature
Section titled “Get Signature”get connectedUsers():
ReadonlySet<string>
Defined in: packages/voice/src/networking.ts:136
User IDs in the channel, from ops 11 and 13.
Returns
Section titled “Returns”ReadonlySet<string>
Get Signature
Section titled “Get Signature”get dave():
DaveSession|undefined
Defined in: packages/voice/src/networking.ts:131
The DAVE session, when Discord negotiated one.
Returns
Section titled “Returns”DaveSession | undefined
Get Signature
Section titled “Get Signature”get ping():
number
Defined in: packages/voice/src/networking.ts:126
Heartbeat round trip in ms, or -1.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
void
Defined in: packages/voice/src/networking.ts:496
Ends the session: gateway, UDP socket, DAVE state. Safe to call twice.
Returns
Section titled “Returns”void
sendFrame()
Section titled “sendFrame()”sendFrame(
frame):boolean
Defined in: packages/voice/src/networking.ts:466
Encrypts one 20 ms Opus frame (DAVE, then transport) and sends it. Sequence and timestamp advance by one frame either way. A frame DAVE cannot end-to-end encrypt yet (the MLS group is not ready) is dropped.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”boolean
Whether it was sent.
setSpeaking()
Section titled “setSpeaking()”setSpeaking(
speaking,flags?):void
Defined in: packages/voice/src/networking.ts:451
Sends op 5. Only sends when the flag changes.
Parameters
Section titled “Parameters”speaking
Section titled “speaking”boolean
flags?
Section titled “flags?”number = 1
Returns
Section titled “Returns”void