Docs/Games/Tic-tac-toe
Games

Tic-tac-toe

Turn-based, 1v1. Same architecture as Checkers — this page covers only what's genuinely different: the move shape and the AFK timing.

Turn-based1v1Hosted: socket + REST

Session creation

json
{ "game": "tictactoe", "matchType": "matchmaking", "players": [{ "id": "user_1" }] }

Socket events

EventDirectionPayload
game:startedserver → client{ roomId, players, board, currentTurn, afkTimeoutEnabled, afkTimeoutSeconds, afkWarnSeconds, playerId, mark: 'X'|'O' }
game:moveclient → server{ roomId, position: number, playerId }
game:move:madeserver → clientBroadcast after a valid move — full updated board + currentTurn
game:overserver → clientResult object, same shape as the game.ended webhook
tictactoe:afk_warning_clearedserver → clientFires when a player about to be AFK-forfeited moves in time

Board

position is a flat index 0–8 into the 3×3 board, row-major.

js
socket.emit('game:move', { roomId, playerId, position: 4 }); // center square

AFK timeout

60 second timeout, 20 second warning — the default; not currently overridable via afkConfig for this game.

Hosted matchmaking

Supports hosted matchmaking via both direct socket events and the REST endpoints — same shape as Checkers.