roomChatHandler.ts 397 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 {
  user.room?.sendChat(user, message.message);
  return { ok: true };
}