errory voice

This commit is contained in:
Amish Shah
2016-08-24 21:38:48 +01:00
parent 48444a5444
commit 8683f45816
20 changed files with 476 additions and 13 deletions

View File

@@ -54,8 +54,13 @@ class VoiceConnectionWebSocket extends EventEmitter {
this.heartbeat = setInterval(() => {
this.send({
op: Constants.VoiceOPCodes.HEARTBEAT,
d: null,
});
}, interval);
this.send({
op: Constants.VoiceOPCodes.HEARTBEAT,
d: null,
});
}
_onMessage(event) {
@@ -77,7 +82,14 @@ class VoiceConnectionWebSocket extends EventEmitter {
for (const index in packet.d.secret_key) {
this.secretKey[index] = packet.d.secret_key[index];
}
this.emit('ready');
this.emit('ready', this.secretKey);
break;
case Constants.VoiceOPCodes.SPEAKING:
/*
{ op: 5,
d: { user_id: '123123', ssrc: 1, speaking: true } }
*/
this.emit('speaking', packet.d);
break;
default:
this.emit('unknown', packet);