Documentation

Build peer-to-peer web apps without signaling servers

Trystero gives JavaScript apps simple rooms, typed actions, request/response channels, binary transfer, and media streams on top of WebRTC.

Start with a room

A room groups peers together. Once users are in the same room, actions let them exchange JSON, strings, binary data, and typed arrays directly.

import {joinRoom} from 'trystero'

const room = joinRoom({appId: 'my-app'}, 'lobby')
const chat = room.makeAction('chat')

chat.onMessage = (message, {peerId}) => {
  addMessage(peerId, message)
}

sendButton.onclick = () => {
  chat.send({text: messageInput.value})
}

Getting started

Install Trystero, join a room, and send your first peer-to-peer message.

Actions

Use message actions for events and request actions for peer answers.

Media streams

Send camera, microphone, and screen-share streams between browsers.

Signaling strategies

Choose Nostr, MQTT, BitTorrent, Supabase, Firebase, IPFS, or your own relay.