Files
bworld/server/game/host_protocol.ts
T
2026-09-24 19:34:07 -03:00

16 lines
570 B
TypeScript

// messages between server/main.ts (the host) and the game server worker
export type HostToGame =
| { type: "init"; save: string | undefined; default_seed: string }
| { type: "connect"; conn: number }
| { type: "message"; conn: number; data: string }
| { type: "disconnect"; conn: number }
// save now and say when it's done, for shutting down
| { type: "shutdown" };
export type GameToHost =
| { type: "ready"; seed: string }
| { type: "send"; conn: number; data: string }
| { type: "close"; conn: number }
| { type: "save"; data: string; final: boolean };