make requeuing and other stuff better

This commit is contained in:
Maieul BOYER 2026-01-01 18:04:02 +01:00 committed by Maix0
parent 972b78a1e2
commit b86d50f9f0
4 changed files with 101 additions and 32 deletions

View file

@ -20,21 +20,22 @@ export type GameUpdate = {
export type GameMove = {
index: number;
}
export type GameMoveResponse = 'success' | 'invalidMove' | 'unknownError';
export interface ClientToServer {
enqueue: () => void;
dequeue: () => void;
debugInfo: () => void;
gameMove: (up: GameMove) => GameMoveResponse;
gameMove: (up: GameMove) => void;
connectedToGame: (gameId: string) => void;
};
export interface ServerToClient {
forceDisconnect: (reason: string) => void;
queueEvent: (msg: 'registered' | 'unregistered') => void;
updateInformation: (info: UpdateInfo) => void,
newGame: (gameId: string) => void,
newGame: (initState: GameUpdate) => void,
gameBoard: (state: GameUpdate) => void,
gameEnd: () => void;
};
export type SSocket = Socket<ClientToServer, ServerToClient>;