voice: more debug

This commit is contained in:
Amish Shah
2019-02-11 18:37:33 +00:00
parent fe51b4e89b
commit c362ba0dd5

View File

@@ -68,13 +68,13 @@ class VoiceWebSocket extends EventEmitter {
}
this.attempts++;
this.emit('debug', `[WS] connecting, ${this.attempts} attempts, wss://${this.connection.authentication.endpoint}/`);
/**
* The actual WebSocket used to connect to the Voice WebSocket Server.
* @type {WebSocket}
*/
this.ws = WebSocket.create(`wss://${this.connection.authentication.endpoint}/`, { v: 4 });
this.emit('debug', `[WS] connecting, ${this.attempts} attempts, ${this.ws.url}`);
this.ws.onopen = this.onOpen.bind(this);
this.ws.onmessage = this.onMessage.bind(this);
this.ws.onclose = this.onClose.bind(this);
@@ -154,6 +154,7 @@ class VoiceWebSocket extends EventEmitter {
* @param {Error} error The error that occurred
*/
onError(error) {
this.emit('debug', `[WS] Error: ${error}`);
this.emit('error', error);
}