Skip to content

Commit

Permalink
message event fix, websocket heartbeat implement.
Browse files Browse the repository at this point in the history
  • Loading branch information
kedi committed May 15, 2021
1 parent 75d8281 commit 2d0e511
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Events/Emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ class EventEmitter {
}
}
}`);

/**
* Heartbeat ack to keep connection on-line.
*/
setInterval(() => {
this.ws.send(`{
"op": 1,
"d": ${WebSocketResponse.s == null ? "null" : WebSocketResponse.s.reverse().split("")[0]}
}`);
},WebSocketResponse.d.heartbeat_interval)
}
});
}
Expand Down
File renamed without changes.

0 comments on commit 2d0e511

Please sign in to comment.