rooms ya no expiran para reconexion

This commit is contained in:
2025-08-28 19:29:39 -06:00
parent 3300c694c5
commit c97778fdb1
2 changed files with 5 additions and 5 deletions

View File

@@ -97,6 +97,8 @@ export class GameRoom extends Room<GameState> {
}
onCreate(options: any) {
// Keep room alive even if all clients disconnect (avoid auto-dispose during reconnection windows)
try { (this as any).autoDispose = false; } catch {}
this.setState(new GameState());
this.state.roomId = this.roomId;
// Expose status via metadata for lobby listing
@@ -472,8 +474,9 @@ export class GameRoom extends Room<GameState> {
}
}
// Allow reconnection; when it happens, mark player connected and resume if both are present
const reconnection = this.allowReconnection(client, 30);
// Allow reconnection without a short timeout; give players ample time to return
// (24 hours window to prevent unexpected room disposal due to short timeouts)
const reconnection = this.allowReconnection(client, 60 * 60 * 24);
reconnection.then((newClient) => {
const p = this.state.players.get(client.sessionId);
if (p) {