Docs/Games/8-Ball Pool
Games

8-Ball Pool

Turn-based, 1v1, server-authoritative physics. The shot itself is simulated server-side — the client sends intent (power, aim, ball-in-hand placement), never a result.

Turn-based1v1Hosted: REST only
Verified directly against the source, not assumed: Pool is the one game of the six where hosted matchmaking has no direct socket event path — there is no socket.on('hosted:submit_group')handler at all here, unlike every other game documented. You must use the REST endpoints under Hosted Matchmaking. Emitting a hosted:* event at this namespace will simply never be received.

Session creation

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

Connect and reconnect

Pool has the longest documented reconnect window of the six games: 60 seconds.

js
socket.on('connect', () => {
  socket.emit('game:reconnect', { roomId, playerId });
});
socket.on('game:reconnected', (fullState) => { /* rehydrate */ });

Socket events

EventDirectionPayload
game:startedserver → client{ roomId, playerId, playerIndex: 0|1, players, ballPositions }
pool:shotclient → server{ roomId, playerId, power: number, rotation: number, cueBallPos?: {x,y} }
pool:shot:resolvedserver → client{ trajectory, outcome, fromPlayerId }
game:overserver → clientResult object, same shape as the game.ended webhook
player:disconnectedserver → client{ socketId }
player:reconnectedserver → clientBroadcast to the room when a player rejoins within the window
game:resignclient → server{ roomId, playerId }

Taking a shot

js
socket.emit('pool:shot', {
  roomId,
  playerId,
  power: 0.72,       // 0-1
  rotation: 1.4,      // radians
  cueBallPos: { x: 200, y: 340 },   // only sent when placing ball-in-hand
});

cueBallPos is applied server-side only when the game state actually has ball-in-hand active for that player — sending it otherwise is simply ignored, not an error.

Shot timer

A player has 90 seconds to take their shot before forfeiting the room to the opponent — starts the moment it becomes their turn, restarted after each shot.