roomListRequestHandler.ts 538 Bytes
import {
  ServerInboundMessage,
  ServerInboundMessageMap,
  ServerResponse,
} from "../../../common";
import { RoomDescription } from "../../../common/dataType";
import { Connection } from "../../connection/Connection";
import { RoomManager } from "../../room/RoomManager";
import { User } from "../../user/User";

export function roomListRequestHandler(
  connection: Connection,
  message: ServerInboundMessage<"roomList">,
  scope: User
): ServerResponse<"roomList"> {
  return { ok: true, result: RoomManager.instance().list() };
}