Appearance
Spread a channel with the server tree
The server tree decides which nodes carry a channel and where each one gets it from. The root pulls from the sources. The other nodes relay from their parent over the network, so your provider sees one connection no matter how many nodes you have.
This was tested end to end on a real server: node 2 relayed from node 1, the relay counted as a viewer on node 1, and node 2 kept playing when node 1 stopped. You need at least two enrolled nodes. See add a node.
Set the tree in the panel
Open the channel and go to Servers. Under Run on, pick the servers that run this channel. Then open Advanced: build a tree. For each server, pick where it gets the stream: From the sources, or Relay from another server. Turn on Use the sources if the parent fails for servers that may talk to the provider. Tree preview shows the result before you save.
Set the tree with the API
Each entry is a node. parent_node_id: null means the node pulls from the sources. Any other value means it relays from that node.
bash
curl -s -X PUT $PANEL/streams/101/tree \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"nodes": [
{"node_id": 1, "parent_node_id": null},
{"node_id": 2, "parent_node_id": 1, "may_pull_source": true},
{"node_id": 3, "parent_node_id": 1},
{"node_id": 4, "parent_node_id": 3}
]
}' | jqRules:
- Every parent must be in the list.
- Cycles are refused with
400 tree_cycle. - Nodes you leave out of the tree stop the channel.
Read it back, with the live status of each node:
bash
curl -s $PANEL/streams/101/tree -H "Authorization: Bearer $TOKEN" | jqWhat happens when a parent fails
The child does not wait for anyone. It tries, in order:
- its parent,
- the grandparent, and so on up to the root,
- the channel's own sources, but only if
may_pull_sourceis on for that node.
In tests, a child went from a dead parent to the source in 0.8 seconds. The control also notices when a parent stops sending heartbeats for 15 seconds and pushes a new tree to the nodes.
Turn may_pull_source on for nodes you trust to talk to the provider. Leave it off if your provider account has very few connections.
How relays work
- A child pulls
/relay/<token>/stream.tsfrom its parent's ring buffer. The token is signed by the control for that parent, so nodes do not need passwords for each other. Relay tokens last 2 to 4 hours and the control refreshes them through config pushes, so a running relay never restarts for a new token. Over the public URL the token carries the child's address, and the parent only accepts it from that address. - Each child builds its own HLS from the relayed TS.
- A relay counts as a viewer on the parent, so on-demand channels start on the parent too.
- Use
internal_urlon a node when other nodes should reach it on a private network address instead of its public host.