Documentation
Trystero connects browsers directly over WebRTC and layers room identities, synced state, roles, RPC, file transfer, and media streams on top. These guides cover version 0.27. Full method signatures and types are listed in the API reference.
Rooms
Peers that join the same appId and room name discover one
another over public relays and open direct WebRTC connections. Here is a
minimal cursor-sharing room:
import {joinRoom} from 'trystero'
const room = joinRoom({appId: 'pixel-party.example.com'}, 'studio-49')
const cursor = room.makeUserState('cursor', {x: 0, y: 0})
window.addEventListener('pointermove', e => {
cursor.set({x: e.clientX, y: e.clientY})
})
cursor.onChange((pos, {userId, self, removed}) => {
if (self) return
if (removed) removeCursor(userId)
else drawCursor(userId, pos)
})
To test two distinct users on one machine, open a second window in a
private profile. Tabs in the same browser profile share one persistent
userId by default.
Getting started
Install, join a room, publish state, send an action, and clean up.
Shared & per-user state
makeUserState, makeState, validation, late-joiner sync, React.
Identity, presence & room access
userId vs peerId, multi-tab presence, passwords, maxUsers, errors.
Admins, roles & moderation
Self-certifying rooms, pinned admins, custom roles, gated state, bans.
Actions, RPC & file transfers
makeAction, request, binary metadata, progress, receive gates.
Audio, video & screen sharing
addStream, onPeerStream, track replacement, stream metadata.
Scaling large rooms
The experimental scale() plugin, direct promotion, and getTopology().
Signaling & relays
Nostr, Supabase, Firebase, MQTT, BitTorrent, self-hosted, and custom relays.
Node, Bun & Deno
Headless peers, local hardware bridges, and passive state backups.
TURN & troubleshooting
Strict firewalls, TURN credentials, ping(), and diagnostics.
Upgrading to 0.27
Breaking changes, renamed APIs, and migration examples.
API reference
Method signatures, config options, TypeScript types, and error codes.