mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
fix voice ws (#922)
This commit is contained in:
committed by
Schuyler Cebulskie
parent
0008a18deb
commit
945a2e370a
@@ -72,10 +72,15 @@ class VoiceWebSocket extends EventEmitter {
|
|||||||
* @type {WebSocket}
|
* @type {WebSocket}
|
||||||
*/
|
*/
|
||||||
this.ws = new WebSocket(`wss://${this.voiceConnection.authentication.endpoint}`);
|
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.onmessage = this.onMessage.bind(this);
|
||||||
this.ws.onclose = this.onClose.bind(this);
|
this.ws.onclose = this.onClose.bind(this);
|
||||||
this.ws.onerror = this.onError.bind(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user