Guides
Watch in a browser
A browser cannot dial an iroh endpoint: WebTransport gives a page a QUIC connection but no endpoint, so there is no hole punching and no way to accept a connection. The media relay speaks WebTransport to browsers and iroh to nodes, and moves broadcasts between them. iroh relays and media relays explains the model.
In short
cargo run -p iroh-live-relay -- --open-pulls # a relay on this machine
irl publish # then open http://localhost:4443/?name=<TICKET>
Watch a broadcast in a browser
The media relay can pull a broadcast by its ticket: it dials the publisher over
iroh, and the publisher needs to do nothing. For a media relay on your own machine,
allow pulls with --open-pulls:
cargo run -p iroh-live-relay -- --open-pulls
irl publish
Then open the media relay in a browser and paste the ticket, or link to it:
http://localhost:4443/?name=<TICKET>
Use http, not https. TCP port 4443 serves the page over plain HTTP.
The page then pins the media relay’s self-signed certificate for WebTransport on
UDP port 4443, which the browser allows only from an http: page. Opening
https://localhost:4443 fails inside TLS, and Firefox then reports “SSL
received a record that exceeded the maximum permissible length”.
A media relay reachable by others should not use --open-pulls, since it lets
anyone make the media relay dial any endpoint. Start it with --auth-key instead,
and give viewers a JWT that grants reading the ticket’s path, in the URL as
?jwt=<token>. See Run a media relay.
Push instead of pull
A publisher can push to the media relay instead, which needs no pull permission:
irl publish --relay <RELAY_ENDPOINT_ID>
irl publish prints the path at which the broadcast appears on the media relay,
live/<publisher id>/<name>. Open that path as the name:
http://localhost:4443/?name=live/<publisher id>/hello.
Publish through a media relay covers the Rust side.
Publish from a browser
The media relay also serves a publish page, which publishes the browser’s camera
and microphone under anon/, by default at anon/hello. A Rust node reads
it by attaching to the media relay and subscribing with Reach::Relays, as
iroh-live/examples/subscribe_test.rs
does. irl watch cannot, since its tickets name a publisher, not a media relay.
Browser support
The viewer needs WebTransport. Chromium works, and Firefox needs version 153
or newer. Safari does not work. Earlier Firefox versions allow only two
concurrent streams that the server opens
(bug 2046262), so
@moq/net refuses them and falls back to WebSocket, which this media relay does
not serve. The connection then fails with a 404 on
ws://localhost:4443/<name>.
The web client
The viewer is a SolidJS and TypeScript client in iroh-live-relay/web,
built with Vite and embedded into the binary. To change it:
cd iroh-live-relay/web
npm ci
npm run dev # dev server with hot reload
npm run build # bundle for embedding, then rebuild the media relay
Where to go next
- Run a media relay before you expose a media relay.
- The
iroh-live-relayreference lists the media relay’s flags.