summary refs log tree commit diff
path: root/src/webrtc/events/Close.ts
blob: 4cf80bb2feb85a2cfbe945fb54272e156fb988a9 (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();
}