boilerplate stuff

This commit is contained in:
Madeline
2022-01-16 02:38:43 +11:00
parent 41fca13db2
commit 1569fec0cf
17 changed files with 556 additions and 244 deletions
+18
View File
@@ -0,0 +1,18 @@
import { WebSocket, CLOSECODES } from "@fosscord/gateway";
import { VoiceOPCodes } from "@fosscord/util";
export async function setHeartbeat(socket: WebSocket) {
if (socket.heartbeatTimeout) clearTimeout(socket.heartbeatTimeout);
socket.heartbeatTimeout = setTimeout(() => {
return socket.close(CLOSECODES.Session_timed_out);
}, 1000 * 45);
socket.send(JSON.stringify({
op: VoiceOPCodes.HEARTBEAT_ACK,
d: {
v: 6,
heartbeat_interval: 13750,
}
}));
}
+1
View File
@@ -0,0 +1 @@
export * from "./Heartbeat"