1 files changed, 9 insertions, 0 deletions
diff --git a/src/webrtc/events/Close.ts b/src/webrtc/events/Close.ts
new file mode 100644
index 00000000..1c203653
--- /dev/null
+++ b/src/webrtc/events/Close.ts
@@ -0,0 +1,9 @@
+import { WebSocket } from "@fosscord/gateway";
+import { Session } from "@fosscord/util";
+
+export async function onClose(this: WebSocket, code: number, reason: string) {
+ console.log("[WebRTC] closed", code, reason.toString());
+
+ if (this.session_id) await Session.delete({ session_id: this.session_id });
+ this.removeAllListeners();
+}
\ No newline at end of file
|