blob: 5c1bd292d0e22e95cb7437c756582450bdc0ba3e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { WebSocket } from "@fosscord/gateway";
import { Session } from "@fosscord/util";
export async function Close(this: WebSocket, code: number, reason: string) {
console.log("[WebSocket] closed", code, reason);
if (this.session_id) await Session.delete({ session_id: this.session_id });
if (this.heartbeatTimeout) clearTimeout(this.heartbeatTimeout);
if (this.readyTimeout) clearTimeout(this.readyTimeout);
this.deflate?.close();
this.removeAllListeners();
}
|