Skip to content

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.

new VoiceNetworking(info, handlers?, options?): VoiceNetworking

Defined in: packages/voice/src/networking.ts:114

VoiceServerInfo

VoiceNetworkingHandlers = {}

VoiceNetworkingOptions = {}

VoiceNetworking

optional mode?: 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

get connectedUsers(): ReadonlySet<string>

Defined in: packages/voice/src/networking.ts:136

User IDs in the channel, from ops 11 and 13.

ReadonlySet<string>


get dave(): DaveSession | undefined

Defined in: packages/voice/src/networking.ts:131

The DAVE session, when Discord negotiated one.

DaveSession | undefined


get ping(): number

Defined in: packages/voice/src/networking.ts:126

Heartbeat round trip in ms, or -1.

number

destroy(): void

Defined in: packages/voice/src/networking.ts:496

Ends the session: gateway, UDP socket, DAVE state. Safe to call twice.

void


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.

Uint8Array

boolean

Whether it was sent.


setSpeaking(speaking, flags?): void

Defined in: packages/voice/src/networking.ts:451

Sends op 5. Only sends when the flag changes.

boolean

number = 1

void