websocket reconnect on failure

This commit is contained in:
evanpelle
2024-08-16 11:06:01 -07:00
parent d062d1ac79
commit 332c2cfcac
13 changed files with 159 additions and 200 deletions
-21
View File
@@ -1,21 +0,0 @@
import {ClientID} from "../core/Game";
import {Client} from "./Client";
export class Lobby {
public clients: Map<ClientID, Client> = new Map()
private startGameTs: number
constructor(public readonly id: string, durationMs: number) {
this.startGameTs = Date.now() + durationMs
}
public addClient(client: Client) {
this.clients.set(client.id, client)
}
public isExpired(now: number): boolean {
return now > this.startGameTs
}
}