Skip to content

Commit

Permalink
Move sendOpcode call outside of promise creation
Browse files Browse the repository at this point in the history
  • Loading branch information
longnguyen2004 committed Feb 4, 2025
1 parent 933faec commit 2b20a38
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/client/voice/BaseMediaConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,16 @@ export abstract class BaseMediaConnection extends EventEmitter {
} else {
encryptionMode = SupportedEncryptionModes.XCHACHA20
}
this.sendOpcode(VoiceOpCodes.SELECT_PROTOCOL, {
protocol: "udp",
codecs: Object.values(CodecPayloadType) as ValueOf<typeof CodecPayloadType>[],
data: {
address: ip,
port: port,
mode: encryptionMode
}
});
return new Promise((resolve) => {
this.sendOpcode(VoiceOpCodes.SELECT_PROTOCOL, {
protocol: "udp",
codecs: Object.values(CodecPayloadType) as ValueOf<typeof CodecPayloadType>[],
data: {
address: ip,
port: port,
mode: encryptionMode
}
});
this.once("select_protocol_ack", () => resolve());
})
}
Expand Down

0 comments on commit 2b20a38

Please sign in to comment.