🐛 only delete session id for authenticated connections

This commit is contained in:
Flam3rboy 2021-09-03 15:57:29 +02:00
parent 48036bdad5
commit c45e1b0f10

View File

@ -4,7 +4,7 @@ import { Session } from "@fosscord/util";
export async function Close(this: WebSocket, code: number, reason: string) { export async function Close(this: WebSocket, code: number, reason: string) {
console.log("[WebSocket] closed", code, reason); console.log("[WebSocket] closed", code, reason);
await Session.delete({ session_id: this.session_id }); if (this.session_id) await Session.delete({ session_id: this.session_id });
// @ts-ignore // @ts-ignore
this.off("message", Message); this.off("message", Message);
} }