Skip to content

Commit

Permalink
Corrige la déconnexion au bout de 2 minutes
Browse files Browse the repository at this point in the history
fixes #1
  • Loading branch information
AdrienC committed Jun 14, 2019
1 parent a118169 commit 48e34ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DiscordGateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class DiscordGateway {
/* Send heartbeat */
_sendHeartbeat() {
if (this._ws && this._ws.readyState === WebSocket.OPEN) {
this._send(getOpHeartbeatPayload());
this._send(this._getOpHeartbeatPayload());
}
}
_messageHandler(data) {
Expand All @@ -73,7 +73,7 @@ export default class DiscordGateway {
break;
case 10: /* hello */
clearInterval(this._heartbeatTimer);
this._heartbeatTimer = setInterval(this._sendHeartbeat, data.d.heartbeat_interval)
this._heartbeatTimer = setInterval(this._sendHeartbeat.bind(this), data.d.heartbeat_interval)
if (config.loggingEnabled) {
console.log(`Token ${this._token}: received hello message: ${JSON.stringify(data, null, 4)}`);
}
Expand Down

0 comments on commit 48e34ef

Please sign in to comment.