summary refs log tree commit diff
path: root/webrtc/src/events/Close.ts
blob: 1c203653a8f1916146290d583a510f2c26dc890e (plain) (blame)
1
2
3
4
5
6
7
8
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();
}