TurnKit Relay
An authoritative server that enforces fair play while your game logic stays on the client. It connects players over WebSocket, validates moves server-side, filters private state per player, and produces a cryptographically signed match result when the game ends or hands off directly to Leaderboards.
Authoritative
Relay validates each move against the live server state before it reaches the rest of the match.
Private By Default
List ownership and visibility rules decide which players receive item data and which only receive filtered updates.
Engine Agnostic
Use it from Unity, Godot, or any custom client through a simple REST and WebSocket integration.
How It Works
1. Connect Players
Clients join a relay session, receive a relay token, and connect to the match WebSocket. The protocol details live in the handshake reference.
2. Validate Every Move
Each move is checked immediately: is it the player's turn, do they own the objects they are manipulating, and is the action valid for the current server state. See the client-to-server messages.
3. Broadcast Filtered State
Relay sends each player only the information they are allowed to see, so private lists stay private without custom filtering logic on the client.
4. Sign The Result
When the match ends, Relay produces a signed result your backend can trust for rewards, progression, or leaderboard updates.
Key Features
Turn Enforcement
Round Robinenforces strict turn order so players cannot act out of turn.Free Moderemoves enforced order for simultaneous or flexible gameplay.
Player Voting
Syncwaits for votes before the game continues.Asynccollects votes in the background while play continues.- On vote failure, Relay can end the match or skip the turn based on your configuration.
Custom JSON Actions
Relay.SendJson(json) forwards your JSON payload to the other players so clients can exchange game-specific data without Relay knowing your full ruleset.
List Operations
Supported operations include spawn, move between lists, remove, shuffle, and targeted selection by top, bottom, random, item ID, or slug.
Hand Hiding & Visibility
Relay manages hidden hands and private zones through server-owned lists. Each list declares its owner (ownerPlayerIds) and visible audience (visibleToPlayerIds).
Ownership Rules
- Ownership controls who can modify the list.
- Visibility controls who receives the full item data, including slugs and contents.
Filtered Delivery
Snapshot shape appears in MATCH_STARTED and deltas in MOVE_MADE.
This design lets your client use natural list names like deck, hand or discard. Relay does not define your game rules, but it does enforce privacy and authoritative state changes while clients can still vote on whether a move followed the intended game logic.
Built for Flexibility
Turn enforcement, voting, and hand hiding are configurable per game. TurnKit handles the hard parts: fairness, security, and state filtering. Your client keeps the game-specific rules, presentation, and UX.
Integrate from Unity, Godot, or any engine over REST and WebSocket. For wire format, message types, reconnect flow, and protocol details, continue to the WebSocket protocol docs.