granitebps.comAll case files

A real-time multiplayer quiz over WebSockets

I built the WebSocket backend for full multiplayer gameplay in a quiz: live rooms for up to 5 players, real-time scoring, room-state synchronization, and reconnect and disconnect handling. When players act at the same moment, it resolves the race condition to the millisecond, so it knows who acted first.

One live room, five players

Player 1
Player 2
Player 3
Player 4
Player 5
Live roomstate, answers, scores

WebSocket, with reconnect handling

Swipe to see the full diagram

At a glance

Race conditions
Resolved to the ms
Players
Up to 5 connected per game
Recovers
Reconnects and disconnects