Making multiplayer reliable: reconnects and dropped connections

By Swapnil Shah · Updated 2026-11-24

Mobile networks drop out. People switch from Wi-Fi to data, lock their phone mid-game and walk into lifts. A multiplayer game that cannot cope with that is not much fun. Here is how Atom Reaction deals with it.

The problem

In the first version, if your connection blinked, the game showed a frozen board and you had to reload. Reloading often lost your seat, and the bot took over your turns almost immediately, so you came back to a game that had moved on.

Automatic reconnect

The game now reconnects by itself. After a drop it retries with a growing delay, starting at half a second and increasing up to eight seconds. It also retries immediately when the page becomes visible again, when the network comes back or when you return to the tab. A small "Reconnecting" pill shows at the bottom so you know what is happening.

Detecting a dead connection

Some connections die silently, so neither side notices. The client sends a small ping every fifteen seconds, and if nothing is heard for twenty five seconds it closes the socket and reconnects. In the worst case a silent failure is noticed in about forty seconds.

Keeping your seat

Seat credentials used to live only in the tab. Now they are stored in the browser so that opening the invite link again, even in a new tab, gives you the same seat back instead of a new one.

A fair grace period

When a player goes offline, the server now waits fifteen seconds before a bot plays their turn. It used to be just over a second, which was far too aggressive. The grace period covers a quick reconnect without making the other players wait for long.

How I tested it

I tested reconnects with a real server and a small proxy placed in front of it. The proxy could reset connections, refuse them, or silently swallow traffic, which are three different failure modes that behave differently in browsers. Testing only the polite case, where the connection closes cleanly, would have missed the silent failure completely.

Why the server decides

Every move is checked by the server, not by the players' phones. That means a slow or briefly disconnected player cannot put the game into a different state from everyone else. When a player reconnects, the server sends the current board, so they continue from the true position and not from whatever their phone last saw.

Lessons for anyone building a real-time game

Frequently asked questions

What happens if my connection drops in the middle of a game?

The game reconnects automatically and puts you back in your seat. A bot only plays for you after a short grace period.

Why does reconnecting sometimes take a few seconds?

The client retries with a growing delay, and a silent connection failure is only noticed after a short timeout.

Is my seat saved if I close the tab?

Yes. Your seat is remembered in the browser, so reopening the invite link returns you to it.

Play Atom Reaction free