Keyboard shortcuts

Press ← or → to go to the previous or next page

Press S or / to search the docs

Press ? to show this help

Press Esc to hide this help

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 relayMedia relay
What it doesForwards encrypted QUIC packets between two endpoints that cannot reach each other directly. It keeps a connection alive when hole punching failsReceives 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 packetsYes. MoQ has no end-to-end encryption, so it reads what it forwards
Who runs itn0 runs public ones, and iroh uses them by defaultYou, or n0 with hosted media relays in preview
Your program doesNothing. iroh picks one on its ownAttaches 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 setupWhat you need
Native apps or irl on both sides, a few viewersNothing. The publisher serves each viewer directly
Peers behind strict NATs or firewallsNothing. iroh falls back to an iroh relay by itself
Viewers in browsersA 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 serveA 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