roomLeaveHandler.ts
474 Bytes
import { ServerInboundMessage, ServerResponse } from "../../../common";
import { Connection } from "../../connection/Connection";
import { Room } from "../../room/Room";
import { RoomManager } from "../../room/RoomManager";
import { User } from "../../user/User";
export function roomLeaveHandler(
connection: Connection,
message: ServerInboundMessage<"leaveRoom">,
scope: Room
): ServerResponse<"leaveRoom"> {
user.room?.disconnect(user);
return { ok: true };
}