← Back to portfolio View on GitHub ↗

SocketXO Logo

SocketXO

Features Demo Architecture Tech Stack

Build Status License Node Version TypeScript React Socket.io Vite


Overview

SocketXO is a high-performance, browser-based real-time Tic-Tac-Toe web application. It is built specifically to demonstrate production-grade real-time system behavior, focusing heavily on connection resilience, server-authoritative state, and deterministic state synchronization over Socket.io.

Features

Demo

Online Match — The Disconnect Handshake

Demonstrating multi-client synchronization and managed recovery during network loss.

Demo-online

[!TIP] This recording showcases the managed 30-second grace period where the server holds the session, notifies the opponent, and restores the full board state upon reconnection.

AI Benchmark Mode

Demonstrating the deterministic Minimax engine.

Demo-ai

Screenshots

Lobby lobby

Game Board game-board


Tech Stack

Layer Technology
Frontend React 19.x, Vite 7.x, React Router v7
Backend Node.js 20+, Express, Socket.io 4.x
Database strictly in-memory data architecture
Testing/Infra Vitest, Playwright

Architecture

SocketXO is built with a state-first, server-authoritative architecture. The system ensures that all clients are perfectly synchronized by treating the backend as the single source of truth for game logic and session state.

System Overview

The Resilient Disconnect Handshake

The centerpiece of SocketXO's reliability is its Disconnect Handshake mechanism. Unlike typical socket apps where a disconnect ends the session, SocketXO enters a managed recovery state.

sequenceDiagram
participant P1 as Player A
participant S as Server
participant P2 as Player B

Note over P1, P2: Active Game Playing
P1-xS: Connection Lost
S->>S: Start 30s Grace Timer
S->>P2: Emit 'player_disconnected'
Note right of P2: UI shows "Opponent Disconnected"

alt Reconnect within 30s
P1->>S: Reconnect with ReconnectToken
S->>S: Validate Token & Rebind Session
S->>S: Cancel Grace Timer
S->>P1: Emit 'reconnect_success'
S->>P2: Emit 'player_reconnected'
S->>P1: Sync full Game State
else Grace Timer Expires
S->>S: Abandon Room
S->>P2: Emit 'game_over' (Opponent Left)
end

Technical Pillars