These examples use a small placeholder codec (
serialize / deserialize). In
production, use a compact binary format: a fixed struct, FlatBuffers, or
bit-packed snapshots. Then snapshots stay small enough to fit in a datagram.Recipe 1 — An authoritative 1v1 duel server
This is a complete server loop. It reads every player’s input. It steps the world at a fixed tick. It broadcasts state. When the match ends, it sends a reliable settlement event.1
Create the authority client
Omit
playerId to take the authority role.2
Fan in every player's input
One callback collects all players. Store the latest input for each player. The
tick loop reads it.
3
Step + broadcast at a fixed tick
On each tick, apply the buffered inputs. Advance the world. Write a
self-contained snapshot.
4
Settle the match with a reliable event
When the match ends, send the result on a reliable event channel. A
dropped settlement would be a bug.The server publishes the event without a
playerId. Thus every client sees
from = "_authority" and knows that the result is server-authoritative.Recipe 2 — A browser player client
This is the matching client. It samples local input on each frame. It sends the input to the server. It renders incoming state. It reacts to the settlement event.1
Join as a player
2
Push input on the client tick
publishInput binds to alice, so the server’s fan-in knows who sent the
frame.3
Render server state
Each state callback is one authoritative snapshot. Interpolate toward it for
smooth motion. Do not block while you wait for a missed snapshot.
4
React to the settlement event
Subscribe to the same reliable channel on which the server publishes results.Delivery is reliable, so this callback fires exactly once, even if a state
datagram was dropped at the same moment.
Recipe 3 — A lobby with presence + chat
Before the match, a room often needs a reliable coordination layer: ready status, chat, and a host that starts the game. This layer uses only the event channels. There is no state/input loop yet.1
Open the lobby channels
Use one channel for each concern. Each channel is an isolated, reliable,
ordered track.
2
Track presence + ready state
Subscribe to
ready. Keep a roster keyed by the decoded sender id.3
Wire chat
Chat is another reliable channel. The SDK decodes the sender id for you.
4
Hand off to the match
When all players are ready, the host (a player or your server authority) sends
a
start event. When a client receives the event, it closes the lobby and
constructs the gameplay client from Recipe 2.Where to go next
SDK Methods
Every method, param, and handle in detail.
Cookbook
Short single-task snippets.
Netcode (Unity)
Run Netcode for GameObjects / Entities over the same wire.
Realtime Tracks
The MoQT primitive that carries these channels.

