roomChatHandler.ts 408 Bytes
import { Connection } from "../../connection/Connection";
import { RoomManager } from "../../room/RoomManager";
import { User } from "../../user/User";
import { MessageResponse, RoomChatMessage, RoomJoinMessage } from "../types";

export function roomChatHandler(
  user: User,
  message: RoomChatMessage
): MessageResponse<undefined> {
  user.room?.sendChat(user, message.message);
  return { ok: true };
}