roomLeaveHandler.ts 368 Bytes
import { Connection } from "../../connection/Connection";
import { RoomManager } from "../../room/RoomManager";
import { User } from "../../user/User";
import { MessageResponse, RoomLeaveMessage } from "../types";

export function roomLeaveHandler(
  user: User,
  message: RoomLeaveMessage
): MessageResponse {
  user.room?.disconnect(user);
  return { ok: true };
}