Docs

Choose how peers discover each other

Trystero uses a signaling strategy only for peer discovery. Your app data still moves directly peer-to-peer over WebRTC.

Default package

The default trystero package uses Nostr for peer discovery and keeps the same room/action API as every strategy package.

import {joinRoom} from 'trystero'

const room = joinRoom({appId: 'my-app'}, 'room-id')

Swap strategies by changing imports

Strategy packages expose the same joinRoom() API, so you can pick the discovery medium that best fits your app and deployment model.

import {joinRoom} from '@trystero-p2p/mqtt'
// or '@trystero-p2p/torrent'
// or '@trystero-p2p/supabase'
// or '@trystero-p2p/firebase'
// or '@trystero-p2p/ipfs'
// or '@trystero-p2p/ws-relay'

const room = joinRoom({appId: 'my-app'}, 'room-id')

Use your own WebSocket relay

Use the WebSocket relay strategy when you want full control over the signaling endpoint while keeping app data peer-to-peer.

import {joinRoom} from '@trystero-p2p/ws-relay'

const room = joinRoom(
  {
    appId: 'my-app',
    relayConfig: {
      urls: ['wss://relay.example.com']
    }
  },
  'room-id'
)