mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 21:12:06 +00:00
fix voice ws (#922)
This commit is contained in:
parent
0008a18deb
commit
945a2e370a
1 changed files with 7 additions and 2 deletions
|
|
@ -72,10 +72,15 @@ class VoiceWebSocket extends EventEmitter {
|
|||
* @type {WebSocket}
|
||||
*/
|
||||
this.ws = new WebSocket(`wss://${this.voiceConnection.authentication.endpoint}`);
|
||||
this.ws.onopen = this.onOpen.bind(this);
|
||||
if (typeof window !== 'undefined') {
|
||||
this.ws.onopen = this.onOpen.bind(this);
|
||||
this.ws.onerror = this.onError.bind(this);
|
||||
} else {
|
||||
this.ws.on('open', this.onOpen.bind(this));
|
||||
this.ws.on('error', this.onError.bind(this));
|
||||
}
|
||||
this.ws.onmessage = this.onMessage.bind(this);
|
||||
this.ws.onclose = this.onClose.bind(this);
|
||||
this.ws.onerror = this.onError.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue