My Player Reconnected. The Race Clock Didn’t Start Again.
A reconnect button is easy to describe until the game has a deadline. I needed a returning player to recover their place without recovering time they’d already used.
In my typing survival game, the server owns the race clock, survival gauge, and elimination decisions. Losing the browser connection doesn’t pause those rules. Reconnecting is a state-restoration problem, not a request to start a fresh race.
This article follows my October 15 implementation and verification record. I haven’t repeated the multiplayer tests for publication, and I haven’t checked every phone’s background-tab behavior.
The rules had to survive the missing socket
The mode supports solo practice and rooms of up to four players. Its configured duration is an integer between 30 and 300 seconds. The start includes eight seconds of protection before the low-speed survival rules apply.
An existing fifteen-second reconnection grace period remained in place. During a disconnection, time continues. An expired grace period or an explicit departure is recorded as leaving, rather than quietly becoming a new participant.
A person joining after a race starts watches until the next race. I didn’t want a late connection to acquire a fresh survival clock halfway through everyone else’s run.
| Boundary | Intended behavior | Recorded verification |
|---|---|---|
| Reconnect during the retained session | Keep player identity | Identity equality passed |
| Reconnect to a running race | Keep the original start timestamp | Start-time equality passed |
| Late spectator | Stay outside the active result set | Spectator exclusion passed |
| Departure | Preserve a distinct disconnected status | Departure record inspected |
| Completed race followed by settings changes | Keep completed results unchanged | Included in implementation record |
The compact reconnect result contains three explicit boolean checks and a departure record. It doesn’t contain an exhaustive log of every reconnect duration. I won’t inflate it into proof that all network failures are handled.
Restoring identity wasn’t enough
I could preserve a player’s name and still get the race wrong. If the restored connection reset the start timestamp, that player would receive time nobody else received.
That’s why I kept identity equality and start-time equality as separate checks. They answer different questions. A familiar avatar on screen isn’t evidence that the server resumed the same competitive state.
The survival rules also continued through the disconnect. I didn’t let browser visibility become the authority for whether the race was advancing. The client could stop presenting frames without earning a pause in the shared match.
I haven’t demonstrated behavior under every mobile operating system’s suspension policy. The server-side rule is clear; complete real-device reconnection coverage is a separate claim I can’t make from these records.
The boundary bug wasn’t a network bug
During implementation, a timer boundary produced a zero-millisecond repeat condition. The work record describes correcting the strict boundary comparison and checking the eight-second and finish-time boundaries afterward.
That’s a concrete failure in advancing the simulation. It wasn’t evidence that WebSockets were unreliable or that the client needed a longer timeout. I’d lose the actual bug if I collapsed every clock problem into “network lag.”
The server calculates survival updates in intervals no larger than twenty milliseconds. At the exact finish boundary, a zero gauge means elimination; a positive gauge means survival. Those semantics need to remain explicit when elapsed time spans several updates.
I didn’t derive those rules from whatever the first generated implementation happened to do. I used the agreed behavior to review and correct the implementation. AI-assisted code still needed an independently stated endpoint.
Don’t confuse a test room with production data
The verification record includes a four-player, thirty-second match with one survivor and three eliminations. It also covers reconnecting, watching, and departure handling. Those checks used the test environment described in the development record.
The production ranking database was backed up and its row hash was checked for preservation. The survival results themselves stayed inside the room rather than being submitted to the shared ranking system.
That separation matters. I didn’t need to overwrite accumulated rankings to prove that a returning player retained the same start time. A test that destroys the data it is supposed to protect isn’t a useful shortcut.
Browser tests also used reduced mobile viewports. They aren’t proof of a real iPhone or Android keyboard session. I keep that limit beside the reconnect claim because real devices add interruption behavior the desktop browser doesn’t reproduce completely.
My earlier rotation-and-pause work concerned a single-player pause policy. A shared race needs a different contract. Here, restoring access restores the player’s connection to the ongoing race. It doesn’t give the player a new clock.