UNPKG

nodito

Version:

Una librería para aprender juegos por turnos en node.

18 lines (17 loc) 676 B
import { Game } from "../Game"; import { User } from "../User"; export declare type MESSAGE_TYPE_FROM_CLIENT = "generic" | "ping" | "info" | "chat" | "createRoom" | "status" | "playGame" | "joinRoom"; export interface IMsgFromClient { clientId: string; token: string; type: MESSAGE_TYPE_FROM_CLIENT; [others: string]: any; } export declare abstract class ClientMessage { protected game: Game; readonly type: MESSAGE_TYPE_FROM_CLIENT; constructor(game: Game); execMessage(message: IMsgFromClient): boolean; validate(message: IMsgFromClient, sender: User): boolean; protected abstract exec(message: IMsgFromClient, sender: User): void; }