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

@@ -35,9 +35,6 @@
<div v-if="!adminUnlocked && showHint" class="round-info">Controles bloqueados clics: {{ clickCount }}/5 para habilitarlos</div> <div v-if="!adminUnlocked && showHint" class="round-info">Controles bloqueados clics: {{ clickCount }}/5 para habilitarlos</div>
<div v-else-if="adminUnlocked" class="round-info">Controles habilitados</div> <div v-else-if="adminUnlocked" class="round-info">Controles habilitados</div>
</template> </template>
<div v-else class="round-info">
Ronda {{ round }} de {{ totalRounds }} aún quedan rondas por jugar. La siguiente comenzará en breve.
</div>
<div v-if="!isFinal" class="hint">Se cerrará en {{ remainingSeconds }}s</div> <div v-if="!isFinal" class="hint">Se cerrará en {{ remainingSeconds }}s</div>
</div> </div>

View File

@@ -97,6 +97,8 @@ export class GameRoom extends Room<GameState> {
} }
onCreate(options: any) { 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.setState(new GameState());
this.state.roomId = this.roomId; this.state.roomId = this.roomId;
// Expose status via metadata for lobby listing // 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 // Allow reconnection without a short timeout; give players ample time to return
const reconnection = this.allowReconnection(client, 30); // (24 hours window to prevent unexpected room disposal due to short timeouts)
const reconnection = this.allowReconnection(client, 60 * 60 * 24);
reconnection.then((newClient) => { reconnection.then((newClient) => {
const p = this.state.players.get(client.sessionId); const p = this.state.players.get(client.sessionId);
if (p) { if (p) {