fix: auto-reconnect on homepage + auto-close match after 30s inactivity
Player reconnection:
- On app boot, checks localStorage for active match
- Verifies match is still 'in_progress' on server before rejoining
- If match ended/aborted → clears recovery, goes to homepage
- If server unreachable → tries to rejoin anyway (optimistic)
Match auto-close:
- handleGet() checks updated_at timestamp on every poll
- If match hasn't been updated in 30+ seconds → both players inactive
- Server marks match as 'completed' with result 'aborted'
- Next player who polls sees status='completed' → game ends cleanly
- Prevents zombie matches lingering forever
Flow:
1. Both players disconnect → no pings → updated_at goes stale
2. After 30s, if either player comes back and polls → server closes match
3. Match shows as 'aborted' → player sees 'game ended' UI
4. If only one player comes back within 30s → they keep playing (match alive)
Co-Authored-By:
Claude Opus 4.6 <noreply@anthropic.com>
Showing
2.49 KB
ludo-playtest/00-ip-test.png
0 → 100644
2.49 KB
ludo-playtest/01-home.png
0 → 100644
103 KB
ludo-playtest/01-initial.png
0 → 100644
129 KB
ludo-playtest/02-no-ludo.png
0 → 100644
129 KB
129 KB