16 lines
570 B
TypeScript
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 };
|