Concepts
iroh relays and media relays
Two different servers are called “relay” in iroh-live, and they do different jobs. These docs always say which one they mean.
| iroh relay | Media relay | |
|---|---|---|
| What it does | Forwards encrypted QUIC packets between two endpoints that cannot reach each other directly. It keeps a connection alive when hole punching fails | Receives a broadcast once and forwards it to many viewers, browsers included. It is a media relay, the iroh-live-relay server |
| Can it read the media? | No. It sees only encrypted packets | Yes. MoQ has no end-to-end encryption, so it reads what it forwards |
| Who runs it | n0 runs public ones, and iroh uses them by default | You, or n0 with hosted media relays in preview |
| Your program does | Nothing. iroh picks one on its own | Attaches to it, or points viewers at it |
Do I need one?
You never set up an iroh relay: iroh uses one by itself when it must. You run a media relay only for browsers or for a large audience:
| Your setup | What you need |
|---|---|
Native apps or irl on both sides, a few viewers | Nothing. The publisher serves each viewer directly |
| Peers behind strict NATs or firewalls | Nothing. iroh falls back to an iroh relay by itself |
| Viewers in browsers | A media relay. A browser cannot dial an iroh endpoint, so it connects to the media relay over WebTransport |
| More viewers than the publisher’s uplink can serve | A media relay. The publisher sends each broadcast to it once, and the media relay serves every viewer |
A node serves each of its viewers itself, so its uplink sets the limit: the uplink divided by the bitrate of the rendition that the viewers pick. Calls and rooms never go through a media relay: each member sends to the others directly.
iroh relays
iroh connects two endpoints directly when it can. On one network they reach each other over the local link, and hole punching opens a direct path through most NATs. When that fails, the packets go through an iroh relay, which adds a round trip. The packets stay encrypted between the two endpoints. The application does not see the change, except as a different round trip and bandwidth, which the player adapts to.
Media relays
A media relay accepts WebTransport sessions from browsers and iroh sessions from nodes, and serves both. It gets a broadcast in one of two ways:
- Pull. A viewer asks for a broadcast by its ticket. The media relay dials the publisher over iroh and subscribes. The publisher does nothing.
- Push. The publisher keeps a session open to the media relay, a media relay
link from
Node::attach_relay. The media relay then receives every publication that the publisher’s grant and audience allow.
Either way, many viewers share one upstream session to the publisher.
A media relay reads the media it forwards. Send a broadcast to one only if
you trust whoever runs it, and only if it keeps each publisher to its own
paths. By default the iroh-live-relay server lets anyone read every
broadcast on it, so read Run a media relay before
you expose one.
Where to go next
- Watch in a browser and Publish through a media relay are the tasks.
- Run a media relay sets one up for others to use.
- Nodes, sessions and routes explains relay links from the node’s side.
- The
iroh-live-relayreference lists the media relay’s flags.