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

How it works

A node publishes broadcasts at paths and subscribes to other nodes’ broadcasts. Every connection a node holds, direct or through a media relay, feeds one route table, and a subscription reads whichever route serves its path.

                 your process
  +--------------------------------------------------+
  |  iroh Endpoint  (key = endpoint id)              |
  |      |                                           |
  |  Node --- policy: who may connect, read, publish |
  |   |                                              |
  |   +-- route table: path -> routes                |
  |   |      ^        ^                              |
  |   |      |        |                              |
  |   |  session    relay link                       |
  |   |  (direct)   (attach_relay)                   |
  |   |      |        |                              |
  |   +-- publications: live/<endpoint id>/hello, ...|
  +----------|--------|------------------------------+
             |        |
         peer node   media relay ---- browsers

The pieces

  • The endpoint is iroh’s. Its key is the node’s identity, and the public half is the endpoint id. See Nodes, sessions and routes.
  • A broadcast is a set of tracks that one node publishes: video renditions, audio, and any data. See Broadcasts, tracks and renditions.
  • A path names a broadcast, such as live/<endpoint id>/hello. A layout is the rule for choosing paths. See Paths, layouts and tickets.
  • A session is a MoQ connection with one peer. A relay link is a session with a media relay that the node keeps open. Both feed the route table. See Nodes, sessions and routes.
  • The policy decides which peers may connect, and what each may read and publish. See Access control.
  • A ticket is a string that names a publisher and a path, for a viewer to paste or scan. See Paths, layouts and tickets.

Publishing

  1. The application binds an endpoint and creates a Node with a policy.
  2. It mounts the node on an iroh Router, so peers can connect to it.
  3. It publishes a broadcast at a path, and fills it with sources.
  4. It shares a ticket for that path.

Encoders run only while someone watches. A broadcast’s audience decides who sees it: every session whose grant covers its path, or a set of peers that the application names.

Subscribing

  1. The viewer creates a Node. A viewer only dials, so it needs no router.
  2. It subscribes to the ticket. The node looks the path up in its route table. If no route is there yet, it dials the publisher or waits for a media relay.
  3. It reads the subscription as media and starts a player.

When the route changes, for example from a media relay to a direct session, the subscription moves with it and does not end (see Nodes, sessions and routes). The player measures the link that serves it, and picks a rendition to match.

Why it is fast

  • Each track has its own QUIC streams. A lost video packet delays only that video track, and audio keeps playing.
  • Direct paths. iroh connects two devices directly where it can, on a local network or through NAT. No server stands between them.
  • Old media is dropped, not queued. A viewer that falls behind skips ahead instead of drifting further from live.

Where to go next