Specification · document 21
21 Deployment and operations
| Status | Draft. Protocol version 1 (sv1) of Sloppy Voice v2. Mostly informative; §6 and the requirements marked "(normative)" are normative. |
| Date | 2026-12-05 |
| Depends on | 00 (overview and conventions), 02 (discovery, ServerMetadata, server keys), 06 (federation), 15 (calls, leases, RelayTicket, relay connection). Uses objects from 03, 04, 05, 07, 08, 09, 10, 11, 12, 13, 14, 16, 17, 18 and 19 by reference. |
| Decisions used | D-001, D-002, D-003, D-004, D-007, D-009, D-012, D-013, D-017, D-018, D-019, D-022, D-025, D-026, D-027, D-030, D-032, D-033, D-037, D-045, D-046, D-047, D-048, D-051, D-052, D-053, D-054, D-056, D-057, D-059, D-061, D-062, D-065, D-066, D-067, D-068, D-071, D-073, D-074, D-086, D-089, D-091, D-093, D-094 |
| Owns | Deployment profiles (informative); the relay-control interface and its sloppyv-relay-control.v1 binding; SFU adapter mappings (informative); operational runbooks (key rotation and compromise, outages, upgrades, admin operations, backup and restore); the informative copy of the limits table |
Status and conformance
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 (RFC 2119, RFC 8174) when, and only when, they appear in all capitals, as shown here.
This document is for people who build and run Sloppy Voice servers. Most of it is informative: it shows how the protocol defined elsewhere can be deployed, scaled and operated with open-source components (D-009), and gives runbooks for routine and emergency operations. It defines no protocol object that another document owns, and it never changes a rule of another document.
It is normative in three places:
| Part | Applies to | Why it is normative |
|---|---|---|
| §6, the relay-control interface | Call control and relays (conformance class Server, 00 §1.5) | 15 delegates "the transport of the relay-control interface" to this document. Its semantics (what is sent, when, and with what effect) bind every server. Its wire binding binds relays and call-control implementations that are built separately (§6.1). |
| §7.1, SFU adapter requirements | SFU-capable server | Restates and makes testable the adapter duties of 15 §4.7 and §8.5. Where this document and 15 differ, 15 wins. |
| Requirements marked "(normative)" in §2.4, §11.1 item 7, §11.6.1 and §11.6.4, and the MUSTs of §8 and §11.2 | Server | Most restate, for operators, invariants that other documents already impose, and name the source (for example 07 §7.3 on IdentityState ver after a restore, 13 §4.2 and §15.6 on MLS generations). A few add a mechanism that those invariants need but their owners don't name: the security journal (§11.6.1), the replay window after a restore (§11.6.4 step 6) and the binding of the first admins to a sign-in identity (§11.1 item 7, which 10 §4.2 delegates to this document). Each says so, and §14 asks the owning documents to adopt them. |
Everything else, including the profiles of §3, the sizing figures of §4, the product mappings of §7.3 to §7.6 and the runbook steps, is informative. A deployment that meets every normative requirement of 00 to 20 conforms, however it is built.
Rationale notes start with "Rationale:" and "Why:" and are informative. "UX:" notes say what users see; 20 owns the exact copy. JSON follows 00 §7: I-JSON, lowerCamelCase members, snake_case enum values, base64url without padding, RFC 3339 timestamps with milliseconds, durations in integer milliseconds ending in Ms.
1. Scope
1.1 In scope
- What each conformance class must run, as components and network endpoints (§2).
- Deployment profiles that show D-009 in practice: a single self-hosted binary, a scaled multi-node deployment, an edge/CDN deployment as one option among several, and a multi-tenant hosting deployment (§3).
- Scaling guidance for WebSocket fan-out, call control, relays, the SFU, MLS Delivery Service storage, sealed content and history shares, attachment storage, federation queues and push (§4).
- Relay deployment requirements (§5) and the relay-control interface between call control and relays (§6, normative).
- The SFU adapter: requirements (§7.1, normative) and mappings onto common SFUs (§7.3 to §7.6, informative).
- Server key rotation and compromise runbooks, using the key lifecycle of 02 (§8).
- The outage matrix and what users see (§9).
- Version skew and upgrade procedures (§10).
- Admin operations: initial setup, enabling a secure server, alias domains, federation blocks, backups and restore, group retirement, limits, moving and shutting down a server (§11).
- An informative copy of every limit, with its owner (§12).
1.2 Out of scope
| Topic | Owner |
|---|---|
| ServerMetadata, server keys, KeyRotation, pins, caching, the domain list | 02 |
| HomeAssertion, remote sessions, S2S requests and events, audiences, federation blocks, outage rules for federation | 06 |
Call object, VoiceLease, LeaseSnapshot, call.tick, RelayTicket, {relayUrl}/connect, data-channel layout, relay forwarding rules, SFU signalling, auto-rejoin |
15 |
voice-dc/1 frames and the relay's per-recipient audio rules |
16 |
video-dc/1, sfu-rtp/1, video adaptation |
17 |
| SFrame and MediaAttestation | 18 |
| Push gateway API and Web Push | 19 |
| Exact user-facing copy, including admin dialogs | 20 |
| The whole-system threat model | 22 |
1.3 Terminology
The terms of 00 §2 apply, in particular Deployment, Server, Relay, SFU, Push gateway, Hosting server and Home server. Operator has the meaning given in 10 §2: whoever runs the deployment and can change its configuration outside the protocol. This document adds:
| Term | Definition |
|---|---|
| Call control | The part of a hosting server that implements 15: seats, leases, snapshots, RelayTickets, routing and SFU signalling. |
| Node | One process or container of a deployment. |
| Relay node | One relay process. |
| Logical relay | Everything reachable at one relay URL (15 §6.1). Usually one relay node; MAY be several (§6.11). |
| Control link | One connection of the relay-control interface between a relay node and the call control of one hosting server (§6). |
| Relay credential | The secret a relay node presents to open a control link (§6.2.2). |
| SFU adapter | The call-control component that drives an SFU (15 §8.5, §7). |
| Drain | Taking a relay node, SFU node or other node out of service without dropping anyone, by migrating its work first. |
| RPO / RTO | Recovery point objective (how much recent data a restore may lose) and recovery time objective (how long a restore may take). |
| Profile | A deployment profile of §3. |
2. Conformance classes and what each server runs
2.1 Conformance classes (recap of 00 §1.5)
| Class | Must run | Notes |
|---|---|---|
| Server | Discovery endpoints and ServerMetadata (02); the HTTPS API and event WebSocket (03); the home-server role (05, 06, 07, 08, 12, 19); the hosting-server role (09 to 15, 19); the server side of secure mode (MLS Delivery Service, the Authentication Service for channels, sealed-content, HistoryShare and VisibilityGrant, KeyPackage, KeyBackup and AccountVault storage); a relay (15, 16, 17); federation in both directions (06). | D-066: every server, even one with no secure context yet. There is no "insecure-only" server class. |
| SFU-capable server | Server, plus an SFU reached through an SFU adapter, and the sfu-rtp/1 feature (15 §8, 17). |
Optional. The relay is still mandatory (D-045). |
| Full client, Web client, Bot client | Client software. | Not deployed by server operators, except that a Web client is served from an origin (§2.4). |
| Push gateway | The gateway API (19). | Run by the publisher of a mobile app build, not by server operators. The project runs the official gateway for its official iOS and Android apps and publishes it as open source (D-093, 19 §11.1); anyone who publishes their own build of the app, with their own APNs and FCM credentials, runs their own copy. |
Rationale: because any server can host a secure DM (D-048) and any account can turn on encryption at any time (D-019), the secure-mode server side is storage and structural checks that every server needs. None of it requires content cryptography on the server.
2.2 Component inventory
| Component | Required? | Specified in | Typical open-source implementation (informative) |
|---|---|---|---|
| HTTPS API and event WebSocket | Required | 03 | The server implementation itself, behind a TLS-terminating reverse proxy (Caddy, nginx, HAProxy, Traefik) or terminating TLS itself. |
| Durable database | Required | All server documents | PostgreSQL; SQLite for single-node deployments. |
| Blob storage for attachments, avatars and icons | Required | 05, 09, 11 | Local filesystem for one node; an S3-compatible object store (MinIO, Ceph RGW, Garage, SeaweedFS) for several. |
| Call control | Required | 15, §6 | Part of the server implementation. |
| Relay | Required (D-066) | 15, 16, 17, §5, §6 | A Go/Pion data-channel relay; any WebRTC stack with SCTP data channels and ICE-lite. |
| SFU and SFU adapter | Optional | 15 §8, 17, §7 | Janus, mediasoup, a Pion-based SFU, LiveKit (with a signalling bridge), or a hosted SFU (§7). |
| Federation outbox workers | Required | 06 §9.7 | Part of the server; a durable queue table in the database. |
| Push sender | Required (home-server role) | 19 | Part of the server; it calls push gateways (APNs and FCM through them) and Web Push services. |
| Key custody for server keys | Required | 02 §11, 04, §8.1 | A hardware security module or KMS (PKCS#11 HSM, SoftHSM, HashiCorp Vault Transit, OpenBao, a cloud KMS) or, at minimum, files outside the database. |
| Validating DNS resolver | Recommended | 02 §15.2 | Unbound, Knot Resolver, systemd-resolved with DNSSEC on, on the same host. |
| Time synchronisation | Required (§2.4) | 00 §7.7 | chrony, ntpd, systemd-timesyncd. |
| Security journal | Required (normative, §11.6.1) | §11.6 | An append-only record outside the main database: an object-store bucket with object lock (write once), an append-only file on the key host, or the key service (Vault, OpenBao, a cloud KMS's companion store). |
| Web client origin | Optional | 20 (hardening), D-065 | Any static web server or CDN, serving the hardening profile of 20. |
| Monitoring | Recommended | §6.12, §9.2 | Prometheus or any OpenMetrics collector; Grafana; Alertmanager. |
2.3 Network endpoints a server exposes
| Endpoint | Protocol and port | Exposed to | Specified in |
|---|---|---|---|
https://<fqdn>/.well-known/sloppyv (optional fallback) |
HTTPS, TCP 443 on the domain's own web host | Everyone | 02 §4 |
{base}/meta, {base}/v1/… |
HTTPS, any HTTP version, TCP 443 (plus UDP 443 for HTTP/3 if offered) | Everyone (open CORS, 00 §7.3) | 02, 03 |
{base}/v1/events |
WebSocket over HTTPS | Clients | 03 |
{relayUrl}/connect |
HTTPS | Clients | 15 §6.2 |
| Relay media | ICE-lite: UDP on a fixed port or range; SHOULD also passive ICE-TCP (15 §6.3) | Clients | 15 §6.3, §5.2 |
| SFU media | Per the SFU (usually UDP) | Clients | 17 |
| Relay-control link | WebSocket over TLS, operator-chosen URL; not under {base}/v1/ |
Relay nodes only | §6.2 |
| SFU adapter southbound | The SFU's native API | The adapter only | §7.2 |
Outbound connections a server makes: DNS (and DoH if used, 02), HTTPS to every federation peer (06), HTTPS to OIDC providers (05), HTTPS to push gateways and Web Push services (19), and NTP.
2.4 Shared requirements for every deployment (normative)
- Clocks. Every node that signs or verifies tokens, or that issues timestamps, SHOULD keep UTC within 1 s of a reliable time source. 00 §7.7 allows ±60 s of skew between parties; a deployment that uses up that allowance internally leaves none for its peers, and a node more than 60 s off fails token checks with every peer. Relays and audio engines measure lease ages on monotonic clocks (15 §4.5), which need no synchronisation.
- TLS. Every endpoint of §2.3 except relay media uses TLS 1.2 or later, TLS 1.3 RECOMMENDED (00 §7.3). Certificates SHOULD come from ACME (RFC 8555) with automatic renewal. The control link MUST use TLS unless both ends are on one host and talk over loopback or a Unix socket.
- One server, one key set. Servers on one deployment MUST NOT share private keys or public keys (02 §14 rule 3).
- Secure flag at creation. The operator's configuration decides whether a server is created secure (09 §3.1). Once a server is secure, no configuration, tool or storage edit may make it insecure (SM-7, D-073, 09 §12). See §11.3 and §11.6.4.
3. Deployment profiles (informative)
These profiles show the same protocol on very different infrastructure. None is required. Each one is built entirely from components that can be self-hosted with open-source software, except where §3.3 shows an optional vendor component next to its self-hosted equivalent (D-009).
3.1 Profile S: one self-hosted binary
For a family, club or small community: up to a few hundred accounts, a few dozen people in calls at once.
Internet
|
DNS: _sloppyv.example.org TXT "v=sv1 url=https://chat.example.org"
|
+-------------+--------------------------------------------+
| one VM or small server (2 vCPU, 4 GB RAM, 100 Mbit/s) |
| |
| Caddy (TLS, ACME) :443/tcp ---> sloppyvoice-server |
| |- HTTPS API + WS |
| |- call control |
| |- relay (Pion) :3479/udp, :3479/tcp ICE-TCP
| |- federation outbox|
| |- push sender |
| '- SQLite + ./blobs |
| keys: /etc/sloppyvoice/keys (0600, not in the database) |
+----------------------------------------------------------+- Process model. One binary runs every server role and the relay. Call control and relay talk in process; they still follow the semantics of §6.1 (snapshot ack, session up and down, key distribution), so the binary can later be split without behaviour changes.
- Storage. SQLite in WAL mode with continuous backup (for example Litestream to any S3-compatible store or to another disk) gives an RPO of seconds (§11.6). Blobs on the local filesystem, backed up with the database. The security journal (§11.6.1) is an append-only file beside the keys, copied off the host with them.
- DNS and TLS. Same-site delegation (02 §15.1):
_sloppyv.example.org→https://chat.example.org, withchat.example.orgon the same registrable domain, so peers recordsame-siteevidence and no DNSSEC is needed. - Ports. The relay uses one UDP port with ICE ufrag demultiplexing (Pion's UDP mux, or equivalent), which is one firewall rule. ICE-TCP on TCP 443 (15 §6.3) needs either a second IP address or a TCP front end that tells TLS from RFC 4571-framed ICE-TCP; on one IP, a different TCP port is the simple choice.
- SFU. None. Video uses
video-dc/1through the relay (15 §7.2 never switches tosfuon a server that isn't SFU-capable). - Capacity, for orientation. 100 Mbit/s of upstream carries about 1,000 relayed secure voice streams (§4.3), for example a 30-person call with two people talking at once (≈ 5 Mbit/s) plus a 1080p screen share watched by 20 people (≈ 50 Mbit/s).
- Secure mode. Works out of the box: the binary includes the Delivery Service, Authentication Service and storage of 13 and 14.
3.2 Profile M: scaled multi-node
For a large community or a company: tens of thousands of accounts, thousands of concurrent call participants, several regions.
Global DNS / anycast LB (TCP 443)
|
+----------------------------+-----------------------------+
| | |
API nodes (stateless) WebSocket gateway nodes Relay pool (per region)
HTTPS commands, session.hello, fan-out, Pion relays, ICE-lite,
validation, authz replay buffers control links (§6)
| | ^
+-------------+--------------+ |
| |
+-----------+------------+ message bus +------+-------+
| Sequencer / context |<--- (NATS, Redis ---->| Call control |---> SFU adapter ---> SFU cluster
| owners (sharded by | Streams, Kafka, | (sharded by | (Janus, mediasoup,
| ctx) | PG LISTEN/NOTIFY) | callId) | Pion SFU, …)
+-----------+------------+ +------+-------+
| |
+--------------+--------------+------------------+----------+---------+
| | | | |
PostgreSQL Object store Federation workers Push workers Key service
(primary + (S3-compatible: (outbox per peer, (gateways, (HSM / KMS /
sync replica, MinIO, Ceph, two lanes, 06) Web Push, 19) Vault Transit)
PITR) Garage)| Concern | How it is placed | Requirement it serves |
|---|---|---|
| Per-context ordering | Exactly one sequencer owns each context at a time (consistent hashing on ctx, plus a fenced ownership lease in the database). It allocates seq and appends durable events in one transaction. |
Gap-free seq per stream: per context, per account me stream and for the community stream (00 §7.4, 03 §7). |
| MLS commits | The context's sequencer also runs the epoch compare-and-set, in the same transaction as the handshake log append and GroupInfo update. | 13 ordering (D-037). |
| Event fan-out | The sequencer publishes each committed event to the bus; gateway nodes holding subscribed sockets deliver it. Gateways keep the per-stream replay window (maxReplayEvents, 03 §16.2) or read it from the database. |
03 §7.4. |
| Calls | Exactly one call-control owner per call (consistent hashing on callId, fenced). It produces snapshots and keeps seats. Each relay node has one control link per issuer, which ends at one call-control node, the link holder (§6.2.1 rule 4). Owners send snapshots and session instructions to the holder over the bus; the holder routes the relay's reports back to each call's owner. |
15 §4.3, §6.2.1. |
| Relays | A pool per region, each node with its own relay URL (§6.11 recommends this over cascading). Relays dial call control (§6.2). | D-045, D-066. |
| Federation | Outbox rows written in the transaction of the causing change; workers deliver per destination and lane. | 06 §9.7, §9.8. |
| Keys | Private keys stay in the key service; nodes call it to sign. | 02 §15.4, 04. |
Failover of an owner (sequencer or call control) uses a fencing token so that a node that lost ownership can't write after its successor started (§10.4).
3.3 Profile E: edge/CDN deployment (one option)
Some operators run on an edge platform. The table maps the components onto Cloudflare's products as one example and gives the self-hosted equivalent of each. Nothing in the protocol depends on any of them (D-009).
| Component | Edge example (Cloudflare) | Self-hosted equivalent | Notes |
|---|---|---|---|
| HTTPS API | Workers | API nodes of §3.2 | Stateless request handling. |
| Per-context sequencer and MLS epoch fence | One Durable Object per context | Sequencer shards of §3.2 | A single-threaded object per context gives gap-free seq and compare-and-set naturally. |
| Event WebSocket | Durable Objects with WebSocket hibernation | Gateway nodes | One socket per client session per server (03 §5.12); subscriptions span contexts, so a per-socket object that subscribes to context objects works better than one socket per context. |
| Call control | One Durable Object per call | Call-control shards | Needs a 1 s timer per call (alarms). Relays dial in (§6.2): one Durable Object per relay node can accept its control link and act as link holder (§6.2.1 rule 4), exchanging messages with the call objects. |
| Database | Durable Object storage, D1 | PostgreSQL | |
| Blobs | R2 | S3-compatible store | Capability download URLs (11 §14.4) map onto presigned URLs. |
| Relay | Containers or VMs, not Workers | Pion relays | The relay needs long-lived UDP sockets, ICE-lite, DTLS and SCTP, and custom per-recipient lease enforcement (15 §4.5, 16 §8.1). A Worker isolate can't run it. |
| SFU | Realtime SFU (formerly Calls), through an adapter (§7.6) | Any SFU of §7 | Optional. |
| Federation queues | Queues, or Durable Object alarms | Outbox workers | Must keep two lanes per destination (06 §9.8). |
| Key custody | Secrets store or an external KMS | HSM / KMS | Keys MUST NOT be visible to every Worker deployment; isolate signing in one service. |
Constraints worth knowing:
- The relay is mandatory (D-045, D-066). An edge deployment always includes at least one relay running on ordinary compute, reachable on UDP.
- Durable Object placement. A context object lives in one location. Users far from it get higher command latency, but events and ordering stay correct.
- CPU limits. MLS commit validation is structural parsing (13), not content cryptography, and fits short request budgets. Ed25519 verification of SealedMessage signatures at ingress (14) is about 50–100 µs per message. A HistoryShare's signature is checked once per share at the same cost (14 §7.7).
3.4 Profile H: a hosting provider with many servers
A provider runs many customers' servers on one deployment (00 §3.4, 02 §14).
- Each customer server has its own base URL (a path per tenant,
https://host.example/t/8f2, or a hostname per tenant; a provider that gives hostnames under one registrable domain to unrelated customers MUST first list that domain in the PSL PRIVATE section (02 §9.3, §15.1)), its own ServerMetadata, canonical domain, keys, accounts and community. Tenants are unrelated at protocol level. - The provider SHOULD offer same-site delegation for customer domains: the customer adds
voice.customer.org CNAME tenant8f2.voicehost.net.and_sloppyv.customer.org TXT "v=sv1 url=https://voice.customer.org", and the provider obtains an ACME certificate forvoice.customer.org(02 §15.1). Peers then recordsame-siteevidence, and later moves or key emergencies don't suspend federation. - Each tenant's private keys MUST be separate (§2.4 item 3). A per-tenant key in a shared HSM partition is fine.
- Relays MAY be shared by tenants. A shared relay node opens one control link per tenant (§6.11) and keeps their calls apart: a RelayTicket from one tenant can never open a session in another tenant's call.
- Per-tenant quotas (storage, call minutes, bandwidth) are business matters. Limits advertised in ServerMetadata MUST still respect every floor (§12).
- A tenant that wants to leave the provider moves its server (02 §15.6) with a URL-bound KeyRotation, keeping its canonical domain and every account.
3.5 Vendor-neutrality checklist (D-009)
A deployment or an implementation is vendor-neutral when all of these hold. Implementers of server software SHOULD check their product against this list.
- Every component of §2.2 can be replaced by an open-source equivalent without changing any protocol behaviour visible to clients or peers.
- Nothing in ServerMetadata, tokens, events or URLs names a vendor or requires a vendor's SDK. (A relay URL or SFU media address on a vendor's network is fine; it is just a URL.)
- Clients use only the protocol of 00 to 20. They never call an SFU's or a cloud provider's own API (15 §8.1).
- Push uses a push gateway whose API (19) is open. The project's gateway, which serves the official apps, is open source (D-093), so any app publisher can run the same software for their own builds, and a server needs no gateway of its own (§4.9).
- The relay can be run by the operator on their own hardware.
4. Scaling (informative)
Figures in this section are estimates for planning. They assume the defaults of the owning documents.
4.1 Sequencing and WebSocket fan-out
Single writer per context. Every durable event of a context gets the next seq with no gaps (00 §7.4). The simplest correct design is one writer per context at a time, which allocates seq and appends the event in one database transaction. Contexts are independent, so they shard freely by ctx.
Fan-out cost. A message in a channel with n subscribed sockets costs one database write and n socket writes. Practical numbers:
| Workload | Per second |
|---|---|
| A busy 5,000-member channel, 2 messages/s, 1,500 sockets subscribed | 3,000 envelope writes |
| Typing indicators in the same channel (ephemeral, 03) | Rate-limited per sender; coalesce per context to at most one typing update per 500 ms per sender |
call.tick for a 200-seat call (one per participating device per second, 15 §4.4) |
200 envelope writes |
Guidance:
- Serialize an event once and write the same bytes to every socket. Per-recipient filtering (for example what a
needs_encryptionmember may see, 09) is decided per subscription, not per event body. - Ephemeral events (typing, presence, call events, ticks) are never stored. A gateway under pressure drops them first (03 §7.6). A queued
call.tickthat has waited more than 250 ms since its snapshot was produced MUST be discarded rather than sent (15 §4.4). - Keep the replay window (
maxReplayEvents, at least 1,000 events and 24 h, 03 §16.2) close to the gateways, for example in the database with an index on (ctx,seq), so a reconnect storm doesn't hit the sequencers. - Reconnect storms. After a gateway restart, spread
retryAfterMsover 0–30 s (03 §5.10), except that sockets of sessions participating in a call get at most 2 s. After a ServerMetadata change, clients wait 0–30 s before refetching (02 §16.1). Size the gateways for a full reconnect within about 60 s. - Slow consumers. A socket whose send buffer stays full is closed with the overflow rule of 03 §7.6; its client resumes from its last
seq.
4.2 Call control and lease snapshots
Each active call costs call control one snapshot per second to its relay (and SFU adapter) and one call.tick per participating device per second over the WebSocket (15 §4.3, §4.4).
| Active calls | Seats | Snapshots/s to relays | Ticks/s on WebSockets |
|---|---|---|---|
| 100 | 1,000 | 100 | 1,000 |
| 2,000 | 20,000 | 2,000 | 20,000 |
- Shard calls by
callId; one owner per call (§3.2). The owner keeps seats and lease inputs in memory and persists enough to survive a restart: the call, its seats withpids and rejoin tokens, and the highest snapshotseqit may have used (15 §4.3 rule 3). A new owner continues withseq = max(last + 1, now in Unix ms). - An owner that can't recover a call's state ends it with
server_restart(15 §2.4). Clients then rejoin with a fresh join (15 §10.8). - Timer accuracy: snapshots every 1,000 ms ± 100 ms (15 §4.3). Revocation snapshots SHOULD leave within 100 ms and MUST within 500 ms of the decision. Don't put revocations behind a batch timer (§6.6).
4.3 Relays
A relay forwards each accepted frame once per eligible recipient (15 §4.5, 16 §8.1). It never decodes or mixes, so its cost is packets and bytes, not codecs.
Voice bandwidth per relayed stream (one participant's microphone to one listener; Opus 32 kbit/s, 20 ms frames, 16 §5):
| Layer | Octets per frame |
|---|---|
| Opus payload | 80 |
voice-dc/1 route header (16 §4.3) |
12 |
| SFrame header and tag (secure calls only; 7-octet KID, about 3-octet counter, 16-octet tag, 18) | 27 |
| SCTP common header and DATA chunk | 28 |
| DTLS 1.2 record with AES-GCM | 37 |
| UDP and IPv4 (IPv6: 48) | 28 |
| Total | 185 insecure, 212 secure |
At 50 frames per second that is about 74 kbit/s insecure and 85 kbit/s secure per stream (93 kbit/s secure over IPv6). Add about 2 kbit/s per session for ticks and, in secure calls, a few kbit/s per active source for MediaAttestations (18).
Relay egress for a call with N seats and S people talking at once is about S × (N − 1) × 85 kbit/s:
N |
S |
Egress |
|---|---|---|
| 10 | 1 | 0.8 Mbit/s |
| 50 | 2 | 8.3 Mbit/s |
| 200 | 1 | 16.9 Mbit/s |
| 200 | 3 | 50.6 Mbit/s |
Video on the relay costs the sender's bitrate times the number of subscribed viewers (15 §6.6), for example a 2.5 Mbit/s screen share watched by 40 people is 100 Mbit/s. Above a handful of viewers, an SFU with simulcast or SVC (17) usually costs less, because each viewer gets a layer that fits its link; 15 §7.2 recommends switching videoRoute to sfu above 8 seats with video.
Packet rate matters more than bytes for software relays: a 200-seat call with one speaker is about 10,000 packets per second out. A Go/Pion relay on one modern core handles on the order of 100,000 to 200,000 forwarded data-channel messages per second, depending on DTLS and SCTP implementation; measure your own.
Guidance:
- Keep per-recipient queues small and bounded, exactly as 16 §8.1 requires (drop at 8,000 buffered octets or 60 ms), and per recipient, so one slow listener never slows the others.
- Spread calls across relay nodes by load (§6.10). One call lives on one logical relay (15 §6.1); a call that outgrows one node is a reason to cascade (§6.11) or to use an SFU for video.
- Place relays near users. Call control picks a relay for a call when the call starts (15 §6.1); a reasonable policy is the relay region closest to the first joiner, re-evaluated through a planned migration (15 §6.9) if most participants turn out to be elsewhere.
4.4 SFU
SFU capacity is vendor-specific. Plan for the SFU's own published figures, the per-viewer layer selection of 17, and the adapter's enforcement duty: each lease change becomes up to one forwarding change per track (15 §4.7), which must take effect within 1,000 ms.
4.5 MLS Delivery Service storage
Per secure group (13):
| Item | Size | Retention |
|---|---|---|
Current GroupInfo with ratchet_tree |
About 1.1–1.4 KiB per leaf; about 1.6–2 MiB for a 1,000-leaf group in JSON (13 §17.1) | While the group exists |
| Handshake log | Commits with an UpdatePath: typically 2–10 KiB each, larger in trees with many blanks; proposals under 2 KiB | At least 30 days (13) |
| Roster and pending proposals | Under 1 KiB per leaf | While the group exists |
Guidance:
- The epoch fence is a compare-and-set on one row per group:
UPDATE … SET epoch = e + 1, groupinfo = … WHERE group_id = … AND epoch = e, in the same transaction as the handshake append. Run it on the primary; never on a replica. - Store GroupInfo as a blob next to the group row, or in object storage with the row holding its hash. Serve it with an ETag so joiners and resyncing devices don't download it twice.
- Uploads up to
maxMlsUploadBytes(default 8 MiB, at least 2,048 ×maxSecureLeaves+ 65,536 bytes, 13 §17.1) must pass the reverse proxy. Configure body limits for…/mls/commitsand…/mls/bootstrapaccordingly, separately frommaxRequestBytes. - When more than 3 commits for one group are in flight, the server answers 425 with
retryAfterMs(13, D-059). Use this as the back-pressure signal; don't queue commits. - Inactive devices are evicted after 90 days (30 for web devices, D-059), which bounds tree growth.
4.6 Sealed content, history shares, KeyPackages and the vault
| Data | Size | Notes |
|---|---|---|
| SealedMessage | Plaintext size rounded up to 256 octets, plus about 120 octets of header, signature and tag, then base64url (14) | Stored like any message; verify the DSK signature at ingress (14). |
| HistoryShare | 48 octets per shared message plus about 150 octets per recipient device, base64url; at most 5,000 messages (about 330 KB) per share (14 §7.3) | Created only by a member's deliberate action, so rare; kept as long as its VisibilityGrant (14 §10.3). The server can't open it. |
| VisibilityGrant | A few dozen octets | One per HistoryShare; checked on every timeline read of the recipient below its visibleFromSeq (14 §10.2). |
| KeyPackage | About 1.2–1.5 KiB with the sv_device credential |
Several per device plus one last-resort KeyPackage (13). Claims MUST be atomic and single use: a claimed KeyPackage is deleted (or marked) in the same transaction that returns it. |
| KeyBackup | Small (keys only) | One active, and at most 3 staged per account (one per device; 08 §5.6.1). |
| AccountVault and key archive | Grows with the number of epochs a user has learned and the message keys shared with the user (shared_keys, 08 §9.5); bounded by maxVaultBytes (08) |
Per-account quota; records are opaque ciphertext. |
4.7 Attachment storage
- Store blobs in object storage, keyed by attachment ID. In secure contexts the blob is client-encrypted and padded (11 §14, 04); the server never needs to read it.
- Downloads MAY redirect to a short-lived capability URL (presigned URL) that expires within 10 minutes and carries no session token (11 §14.4). This lets a CDN or the object store serve bytes directly.
- Deletion: the server stops serving a deleted or expired blob at once and deletes it within 24 h, and removes it from backups within the backup rotation, which SHOULD be at most 30 days (11). Object-store versioning and lifecycle rules must honour this: a bucket that keeps old versions for 90 days breaks the rule.
- A secure-context blob for a
maxAttachmentBytesfile is larger than the file:svf1Size(maxAttachmentBytes), 27,269,675 bytes for the 25 MiB default (04). Proxy and object-store limits must allow it. - Uploaded HTML or SVG must never run as script on the API origin. Serve blobs with
nosniff, a sandbox CSP andContent-Disposition: attachment(11) on every blob, whatever origin serves it (11 §14.4); serving blobs from a separate origin is RECOMMENDED in addition.
4.8 Federation queues
06 §9.7 and §9.8 define the queues. Operationally:
- Outbox in the same transaction. An event is enqueued in the transaction of the change that causes it. A separate message broker is fine only if writes to it are transactional with the database (for example an outbox table that a relay process drains into the broker).
- Two lanes per destination.
high(revocations, deletions, call rings) andnormal(everything else). Size worker pools so that thehighlane never waits behindnormal: at least 2 concurrent requests per destination per lane (06 §9.8), and at least max(32, ⌈P / 50⌉) destinations in parallel for a revocation fan-out, where P is the account's number of audience peers (06 §11.3). - Sizing. A home server with 50,000 accounts, each with an audience of about 10 peers (06 §11.1), that revokes 1 % of devices per day sends about 5,000 high-lane events per day. A hosting server's
notify.eventtraffic is coalesced over 30 s per recipient (00 HP-9), so it scales with active recipients rather than messages. - Back-off state is per destination and lane (06 §9.7). One peer that is down accumulates up to 24 h of events; plan queue storage for the largest peer's daily volume.
- Deduplication. Receivers keep event IDs long enough to deduplicate retries (06 §9.5). Use a table with a time index and purge by age.
- Monitor the 95th percentile of revocation fan-out acknowledgement time; 06 §11.3 sets a 10 s target.
4.9 Notifications and push
- The home server stores a notification record and sends a push carrying only the record ID (D-051, 19). Push sending is a queue with its own workers, separate from federation.
- A push gateway is run per app build by that build's publisher (19). For the official iOS and Android apps that is the project's official gateway (D-093). A server operator doesn't need one unless they publish their own app build. Web Push needs no gateway; the server needs a VAPID key (02 §7.3.1
webPushKey). - ServerMetadata
endpoints.push.gatewayPolicy(02) decides whether the server delivers to any gateway or only to listed ones. Server software defaults toany(D-093, 19 §11.1), so a new server delivers to the official apps and every other app build with no configuration.listedis for operators who must control where wake-ups go; it stops background notifications for every app whose gateway isn't listed, including the official apps unless the official gateway is on the list (20ST.push_not_allowed).
4.10 Where consistency is required
| Operation | Consistency needed | Owner |
|---|---|---|
seq allocation per stream (context, me, community) |
Single writer, gap-free | 03 |
| MLS epoch fence | Compare-and-set on the group row | 13 |
| KeyPackage claim | Atomic remove-on-claim | 13 |
jti consumption (HomeAssertion, S2S tokens, RelayTicket) |
Single use across all nodes that accept the token type | 06, 15 |
IdentityState ver |
Strictly increasing per address; never reused, even across restore | 07 |
| Idempotency keys and client-generated IDs | Unique per scope for at least 24 h | 03 |
Lease snapshot seq |
Strictly increasing per call | 15 |
| Pairing session attempts | One attempt per session (D-053) | 08 |
| Channel and server security flags | Never go back to insecure | 09 |
Everything else (profiles, presence, read state, typing) tolerates eventual consistency.
5. Relay deployment
This section collects what a relay needs from its deployment. The forwarding rules themselves are in 15 §4.5 and §6, and 16 §8.1; nothing here changes them.
5.1 What a relay is
A relay is a WebRTC endpoint that terminates one RTCPeerConnection per participation (15 §6.2), with the three negotiated data channels of 15 §6.4. It:
- validates RelayTickets (15 §5.2) with keys it gets over the control link (§6.7) or from ServerMetadata;
- keeps, per call, the newest LeaseSnapshot and re-emits it to every session as
call.tick(15 §4.4); - forwards media and control messages under 15 §4.5 and 16 §8.1, per recipient;
- reports sessions up and down, acknowledges snapshots and reports load over the control link (§6);
- never decodes, decrypts, mixes or stores media, and never holds media keys.
A relay holds no durable state. Restarting it loses its sessions, which clients repair by rejoining (15 §10); a drain avoids even that (§6.9).
5.2 Network
- ICE-lite with public host candidates on UDP (15 §6.3). Behind a 1:1 NAT (cloud VMs), the relay MUST advertise the public address (for example Pion's NAT 1:1 IP setting); otherwise clients can't reach it.
- One UDP port per relay node, with ICE ufrag demultiplexing, is RECOMMENDED. It keeps firewall rules simple and avoids port-range exhaustion.
- ICE-TCP (passive, RFC 6544) SHOULD be offered for networks that block UDP, preferably on TCP 443 (15 §6.3). TCP 443 on the same IP as the HTTPS API needs a front end that distinguishes TLS from RFC 4571 framing; otherwise use a separate IP address.
- No TURN or STUN. Every call's media goes through the hosting server's relay or SFU (D-094), and relays have public addresses that clients reach by design, so a deployment runs no TURN or STUN service.
- The relay's HTTPS endpoint (
{relayUrl}/connect) answers CORS like a/v1/endpoint (15 §6.1). It MAY sit behind the same reverse proxy as the API, but the UDP and ICE-TCP media ports are reached directly. - DDoS. A relay allocates WebRTC resources only after a valid ticket (15 §5.2), and rejecting an invalid one costs one Ed25519 verification. Rate-limit failed
/connectattempts (invalid, expired or replayed tickets) per IP address, for example 30 per minute. Limit valid tickets per issuer and per (cid,pid), not per IP address. If a per-IP cap on all/connectrequests is kept, size it for carrier-grade NAT, offices and schools (several hundred per minute, with bursts): during a failover or drain (§6.9) every participant behind one address reconnects within seconds, and a cap that refuses them leaves people stuck on "Can't connect to the call right now". Call control's pacing of migrations (§6.9) already spreads that load. Drop unsolicited UDP at the network edge where possible.
5.3 Isolation
A relay node that serves several servers (§3.4, 02 §14) keys every call by (issuer, callId), where the issuer is the hosting server whose control link opened the call (§6.11). The issuer of each link is fixed by the relay's own configuration, never taken on trust from call control (§6.2.2). A RelayTicket is accepted only if its iss is that issuer, and only with that link's key set. Per-session queues, inbound caps (16 §8.1, maxInboundKbps of 15 §6.6) and metrics (§6.12) are kept per session and per issuer.
5.4 What a relay logs
A relay needs, for operations, counters and errors; it doesn't need to know who talked to whom. It SHOULD NOT log addresses (sub), device IDs or client IP addresses except in short-lived (at most 7 days) security logs used to investigate abuse, and MUST NOT log media payloads, SFrame KIDs or counters, or SDP bodies beyond what is needed to debug a failed negotiation. Metrics (§6.12) carry no per-user labels.
6. The relay-control interface (normative)
15 specifies what call control decides and what relays enforce. This section specifies how the two talk: what call control tells a relay, what a relay reports back, how fast, and over which wire binding.
6.1 Model and applicability
- Parties. The interface connects the call control of one hosting server (the issuer, identified by its canonical domain) with one relay node. Each such connection is a control link. A relay node has at most one control link per issuer, and a relay node that serves several hosting servers has one control link per server (§6.11). Where call control runs on several nodes, one of them terminates the link (the link holder, §6.2.1 rule 4) and acts for all of them.
- Semantics bind every server. Every server MUST implement the operations of §6.1.1 with the semantics and timings of §6.3 to §6.10, whether call control and relay run in one process or many.
- The wire binding (
sloppyv-relay-control.v1, §6.2) is REQUIRED whenever call control and the relay are separate programs that can be upgraded or replaced independently of each other, including a relay from a different implementation. It is RECOMMENDED for every deployment that runs relays as separate processes. A single binary that runs both in one process MAY use internal calls instead.
Proposed decision PD-21-1: call control and relays that are separate programs talk over the sloppyv-relay-control.v1 WebSocket binding of §6.2, opened by the relay. Rationale: a published binding lets operators combine any server implementation with any relay (D-009), for example a Go/Pion relay with a server written in another language, and relay-initiated connections let relays scale out and sit behind NAT without call control keeping an inventory of addresses.
6.1.1 Operations
| Operation | Direction | Message (§6.4, §6.5) | Purpose |
|---|---|---|---|
| Register | relay → control | relayctl.hello / relayctl.welcome |
Authenticate, exchange URLs, capacity and keys, resynchronise calls. |
| Set keys | control → relay | relayctl.keys / relayctl.keys_ack |
The issuer's sign keys for RelayTicket validation (15 §5.2). |
| Open call | control → relay | relayctl.call_open |
Create call state before the first snapshot. |
| Deliver snapshots | control → relay | relayctl.snapshot |
Apply LeaseSnapshots (15 §4.3, §4.5). |
| Acknowledge snapshots | relay → control | relayctl.ack |
Confirm application (needed by 15 §11 step 3). |
| Close session | control → relay | relayctl.session_close |
Remove one participation's relay session (15 §2.6, §4.5). |
| Drain call | control → relay | relayctl.call_drain |
Start a planned relay migration of one call (15 §6.9). |
| Close call | control → relay | relayctl.call_close |
The call ended or moved away; free state. |
| Report session up / down | relay → control | relayctl.session_up, relayctl.session_down |
Drive the seat state machine (15 §2.6, §6.7). |
| Report load and state | relay → control | relayctl.load, relayctl.call_stats |
Relay assignment (15 §6.1, §6.10); per-call video fan-out (17 §13.2). |
| Heartbeat | control ↔ relay | relayctl.ping, relayctl.pong |
Detect link loss (§6.8). |
| Report errors | either | relayctl.error |
Reject a malformed or unacceptable message. |
6.2 The sloppyv-relay-control.v1 binding
6.2.1 Connection
- The relay is the WebSocket client (RFC 6455). It connects to the issuer's control URL, which the operator configures on the relay together with the issuer's canonical domain (§6.2.2). The control URL is an absolute
wss:URL, or aws:URL whose host is a loopback address (127.0.0.0/8,::1orlocalhost); an implementation MAY instead use a Unix domain socket on one host, which has no URL. It is not a protocol endpoint of the server: it MUST NOT be under{base}/v1/(00 §7.3), it isn't advertised in ServerMetadata, and it SHOULD NOT be reachable from the public Internet except by relays (for example an internal network, a VPN, or a firewall rule). - The WebSocket subprotocol is
sloppyv-relay-control.v1. Call control MUST refuse a handshake without it (HTTP 400, problemcore.unsupported_version). - TLS 1.2 or later is REQUIRED (TLS 1.3 RECOMMENDED), except over loopback or a Unix domain socket on one host.
- One link per (relay node, issuer). A relay node opens at most one control link per issuer. Where call control runs on several nodes, the node that accepts the link is the link holder for that
relayId, and call control MUST keep a fenced, deployment-wide record of which node holds eachrelayId's link (the fencing of §10.4). Then:- a call's owner sends its snapshots,
relayctl.call_open,relayctl.session_close,relayctl.call_drainandrelayctl.call_closeto the holder over the deployment's internal bus, and the holder writes them to the link. Every timing of this section counts from the owner's decision to the write on the link: an immediate snapshot, for example, is on the link within 500 ms of the decision (15 §4.3); - the holder routes every relay report (
relayctl.ack,relayctl.session_up,relayctl.session_down, and each entry ofrelayctl.call_stats) to the owner of the call it names, andrelayctl.loadand the link state (§6.8) to every node that assigns calls; - if a node accepts a new link from a
relayIdwhose link another node holds, it becomes the holder through the fenced record, and the previous holder closes the old link with code 4009 (§6.2.4). Call control treats the new link as a resynchronisation (§6.8). A single-node call control does the same locally.
- a call's owner sends its snapshots,
- Handshake timers. Call control closes the link with 4008 if no
relayctl.helloarrives within 10,000 ms of the WebSocket opening. The relay closes the link with 4008 and retries (§6.8) if norelayctl.welcomeorrelayctl.errorarrives within 10,000 ms of sendingrelayctl.hello.
Proposed decision PD-21-5: a relay node holds one control link per issuer, terminated by one call-control node (the link holder), which routes messages between the link and the owners of the calls on it. Rationale: several links per (relay node, issuer) would need every report to name the call-control node it is for, and would make 4009 replacement ambiguous. One holder per link keeps the relay simple and puts the routing where the deployment's bus already is.
control-url = "wss://" authority path-abempty [ "?" query ] ; RFC 3986
/ "ws://" loopback-host [ ":" port ] path-abempty [ "?" query ]
loopback-host = "localhost" / "[::1]" / "127." 1*3DIGIT "." 1*3DIGIT "." 1*3DIGIT
relay-id = 1*64( ALPHA / DIGIT / "." / "_" / "-" )
credential = 22*86( ALPHA / DIGIT / "-" / "_" ) ; base64url, >= 128 bits
subprotocol = %s"sloppyv-relay-control.v1"6.2.2 Authentication
The relay authenticates in the WebSocket handshake with one of:
Authorization: Bearer <credential>, where the credential is a random value of at least 128 bits (22 base64url characters or more), issued by the operator for one (relay node, issuer) pair. Call control stores only a SHA-256 hash of each credential and compares in constant time. It MUST accept at least two credentials per relay node at a time, so credentials can be rotated without downtime (§8.7); or- a TLS client certificate that call control maps to exactly one
relayId.
Failure: HTTP 401 with a problem object (00 §7.9) of code core.unauthenticated, with the members 03 registers for it (a relay ignores userAction). The relay retries with the schedule of §6.8 but logs the failure and alerts its operator after 3 consecutive authentication failures.
Call control also MUST check that every URL the relay names in relayctl.hello is one the operator has allowed for that relayId; otherwise it sends relayctl.error (core.forbidden) and closes with 4003.
The relay authenticates the issuer too. The relay's configuration binds each control URL (and the credential it presents there) to exactly one expected issuer, a canonical domain. The relay:
- MUST close the link with 4003 if
relayctl.welcomenames anissuerother than the one configured for that control URL, and MUST verify the server's TLS certificate for the control URL's host (except over loopback or a Unix socket); - MUST NOT hold two links that claim the same issuer from different control URLs: it refuses the second with a close 4003 and alerts its operator;
- validates the RelayTickets of a call only with the key set of the link that opened that call (§6.7 rule 1);
- SHOULD, when it serves issuers run by different operators (§3.4, §6.11), check the
signkeys it receives inrelayctl.welcomeandrelayctl.keysagainst the issuer's ServerMetadata (02 §11.6), and refuse a key set that names a key the issuer doesn't publish.
Rationale: relays are part of the hosting server's trust domain (15 §17 item 1), so a simple bearer credential or mTLS suffices in one direction. But on a relay shared by several issuers, an issuer value taken on trust from call control would let one tenant's call control mint tickets for another tenant's calls; binding the issuer in the relay's own configuration closes that. Nothing on the link is a media key or content.
6.2.3 Framing
Every WebSocket message is one UTF-8 text frame holding one JSON object (I-JSON, 00 §7.2) of at most 1 MiB:
| Member | Type | Required | Meaning |
|---|---|---|---|
v |
integer | Yes | 1. A receiver closes the link with 4026 on any other value. |
t |
string | Yes | Message type, from §6.3. |
id |
string | Yes | UUIDv7 of this message (00 §7.6). |
re |
string | No | On replies: the id being answered. |
ts |
string | Yes | Sender's clock at sending, RFC 3339 with milliseconds. Informative; no rule depends on it. |
d |
object | Yes | Payload, defined in §6.4 and §6.5. |
- Message types use the namespace
relayctl. They belong to this subprotocol only: they are not event types of 03's registry and never appear on a client WebSocket, a relay data channel or a federation endpoint. - Receivers ignore unknown members, and ignore messages of unknown
t(no error). - Binary frames are a protocol error: close with 1003.
Proposed decision PD-21-2 (adopted; 00 §7.5 and 03 §10.4 allocate relayctl): the message namespace relayctl is allocated to this document in 00 §7.5 and 03's registry, for messages of the sloppyv-relay-control.v1 subprotocol only, with no event types and no error codes. Rationale: 00 §7.5 requires dotted, owned type names; a separate namespace keeps internal messages from colliding with 15's relay.* messages that clients see.
6.2.4 Errors and close codes
relayctl.error carries a problem object (00 §7.9) in d and re naming the offending message. It never closes the link by itself. This document defines no error codes; it uses these existing ones:
| Code | When |
|---|---|
core.invalid_request |
A message is malformed or violates a constraint of §6.4 or §6.5. data.errors (03 §10.5) points at the offending member; re names the offending message. |
core.unsupported_version |
relayctl.hello names a protocol whose major version call control can't speak. Call control sends this error and closes with 4026. |
core.forbidden |
The relay named a URL it isn't allowed to serve. |
core.conflict |
relayctl.call_open for an open call with a different security, ctx or url. |
relay.call_unknown (15) |
A message names a call that isn't open on this link. |
| Close code | Meaning | Relay action |
|---|---|---|
| 1000 | Normal close (call control is stopping the link cleanly, for example on its own restart) | Reconnect with the §6.8 schedule. |
| 1001 | Going away (shutdown or drain finished) | Reconnect with the §6.8 schedule. |
| 1003 | Binary frame received | Log the bug; reconnect with the §6.8 schedule. |
| 4001 | Authentication failed after the handshake (credential revoked) | Stop retrying; alert the operator. |
| 4003 | Forbidden (URLs not allowed, relay disabled by the operator, wrong or duplicate issuer, §6.2.2) | Stop retrying; alert the operator. |
| 4008 | Heartbeat or handshake timeout (§6.2.1 rule 5, §6.8) | Reconnect at once, then with the §6.8 schedule. |
| 4009 | Replaced by a newer link from the same relayId |
Don't reconnect this link. |
| 4026 | Unsupported binding version | Stop retrying; alert the operator. |
After 4001, 4003 or 4026 the relay treats that issuer's calls and sessions exactly as in state lost (§6.8): forwarding stops by itself 3 s after each call's last snapshot, and after 30 s it closes the sessions and frees the calls. It doesn't retry until the operator changes its configuration or restarts it. Clients see an unexpected drop and rejoin (15 §10), and call control fails their calls over to another relay (§6.9.3).
6.3 Message catalogue
t |
Direction | Reply | Section |
|---|---|---|---|
relayctl.hello |
relay → control | relayctl.welcome |
6.4.1 |
relayctl.welcome |
control → relay | — | 6.4.1 |
relayctl.keys |
control → relay | relayctl.keys_ack |
6.4.2 |
relayctl.keys_ack |
relay → control | — | 6.4.2 |
relayctl.call_open |
control → relay | relayctl.error only on failure |
6.4.3 |
relayctl.snapshot |
control → relay | relayctl.ack |
6.4.4 |
relayctl.ack |
relay → control | — | 6.4.4 |
relayctl.session_close |
control → relay | relayctl.session_down if a session existed |
6.4.5 |
relayctl.call_drain |
control → relay | — | 6.4.6 |
relayctl.call_close |
control → relay | — | 6.4.7 |
relayctl.session_up |
relay → control | — | 6.5.1 |
relayctl.session_down |
relay → control | — | 6.5.2 |
relayctl.load |
relay → control | — | 6.5.3 |
relayctl.call_stats |
relay → control | — | 6.5.4 |
relayctl.ping |
control → relay | relayctl.pong |
6.8 |
relayctl.pong |
relay → control | — | 6.8 |
relayctl.error |
either | — | 6.2.4 |
6.4 Registration and call control messages
6.4.1 relayctl.hello and relayctl.welcome
relayctl.hello is the relay's first message on a new link. Call control answers with relayctl.welcome (with re set) or with relayctl.error and a close. Until the welcome, neither side sends anything else.
relayctl.hello payload:
| Member | Type | Required | Meaning and constraints |
|---|---|---|---|
relayId |
string | Yes | relay-id (§6.2.1). Operator-assigned, stable across restarts of the node. |
protocol |
string | Yes | Binding version, major.minor (03 §12.1 grammar). This document is "1.0". |
urls |
array of string | Yes | 1–8 relay URLs (15 §6.1 relay-url) at which this node accepts /connect. |
software |
string | No | Product and version, at most 64 characters, for diagnostics. |
region |
string | No | Operator's location label, 1–64 characters of [a-z0-9-]. |
capacity |
object | Yes | {"maxSessions": integer, "maxEgressKbps": integer}, both ≥ 1: what the operator configured this node to carry. |
state |
string | Yes | accepting, full or draining (§6.5.3). |
calls |
array of string | Yes | The callIds this node holds state for under this issuer, from an earlier link (§6.8). Empty after a restart. At most 10,000 entries. |
relayctl.welcome payload:
| Member | Type | Required | Meaning and constraints |
|---|---|---|---|
issuer |
string | Yes | The hosting server's canonical domain. Every call opened on this link belongs to it (§6.11). The relay MUST check it against its configuration (§6.2.2). |
protocol |
string | Yes | The binding version call control will use: the highest minor of the shared major. |
linkId |
string | Yes | UUIDv7 naming this link, for logs. |
keysVersion |
integer | Yes | Version of the key set below, ≥ 1. It never decreases for an issuer, across restarts and changes of link holder (§6.4.2). |
keys |
array of ServerKey | Yes | The issuer's ServerKeys (02 §11.1) whose purpose is sign, with their current status. 1–16 entries. |
revoked |
array of string | Yes | RFC 7638 thumbprints of every sign key the issuer has revoked in the last 400 days. |
heartbeatMs |
integer | Yes | 1000 in this version (§6.8). |
maxInboundKbps |
integer | Yes | Default inbound cap per session (15 §6.6), default 10000. A call MAY override it (§6.4.3). |
After the welcome, call control resynchronises (§6.8):
- For every call currently assigned to this
relayId, whether or nothello.callslists it, it sendsrelayctl.call_openand then the newest snapshot. A relay that restarted (emptyhello.calls) thus gets its calls back, and clients that rejoin find them. - For each
callIdinhello.callsthat isn't assigned to this relay, it sendsrelayctl.call_closewith reasonmigrated(the call lives on another relay),lost(call control lost the call's state, §6.4.7) orunknown(call control has no record of it).
Open-call state is per link: a new link starts with no call open on it, at both ends, so §6.6 rule 4 applies afresh. The relay keeps the forwarding state and sessions of calls it already held (§6.8) and applies the relayctl.call_open for them as the repeated, identical open of §6.4.3.
6.4.2 relayctl.keys and relayctl.keys_ack
relayctl.keys replaces the relay's key set for the link's issuer. Payload: {keysVersion, keys, revoked} with the meanings of §6.4.1. The relay applies it atomically, ignores a keysVersion not higher than the one it holds, and answers relayctl.keys_ack with {"keysVersion": n} naming the version it now holds.
The key set in relayctl.welcome is different: it always replaces the relay's key set for that issuer, whatever its version, because it is the start of a new link. It counts as acknowledged for rule 2 once the link reaches linked (§6.8).
Rules for call control (§6.7 gives the reasons):
- It MUST send
relayctl.keyson every link within 1,000 ms of any change to the issuer'ssignkeys: a key added, a status change, or a revocation. - It MUST NOT sign a RelayTicket with a key until every relay node whose link is in state
linked(§6.8), and that hosts or may receive calls of this issuer, has acknowledged akeysVersionin which that key is usable for tickets under §6.7 rule 3 (active, ornextwith itsnbfpassed). Relay nodes without a link get the key in their nextrelayctl.welcome. - A relay that hasn't acknowledged a
relayctl.keyswithin 2,000 ms is treated as failed: call control closes its link with 4008, stops assigning calls to it, and handles the link as in §6.8 (it fails the relay's calls over if the relay doesn't link again within 1,000 ms). From the close on, that relay doesn't count for rule 2. Rule 2 therefore holds back a new key for at most about 3 s, and never blocks revocation: a revocation takes effect on each relay when that relay applies it. keysVersionMUST be persisted, or derived from persistent state, so that it never decreases for an issuer across restarts and changes of link holder. The Unix time in milliseconds of the key change is a simple choice.
6.4.3 relayctl.call_open
Creates call state on the relay. Call control sends it before the first snapshot of a call on that relay: when it assigns a new call to the relay (15 §3.3.2 step 5), when it migrates a call to the relay (15 §6.9), and when it resynchronises (§6.8).
| Member | Type | Required | Meaning and constraints |
|---|---|---|---|
callId |
string | Yes | The call (15 §2.5.1). |
ctx |
string | Yes | The call's context reference. Used for logs and for the ticket check of §6.7 rule 2. |
security |
string | Yes | insecure or secure: the call's fixed mode (15 §2.1 rule 3). The relay uses it for the protection-flag check of 16 §4.9.2. A relay MUST refuse an unknown value with core.invalid_request and not open the call. |
url |
string | Yes | Which of the relay's urls this call is assigned to; RelayTickets for the call carry it as aud (15 §5.1). |
profiles |
array of string | Yes | Relay profiles allowed in the call: a subset of voice-dc/1, video-dc/1. |
maxInboundKbps |
integer | No | Per-session inbound cap for this call; default from the welcome. |
The relay creates the call in a no-snapshot state: it forwards nothing for the call until a snapshot arrives (15 §4.5 rule 1). A repeated relayctl.call_open with identical values is a no-op; one that changes security, ctx or url is refused with core.conflict. maxInboundKbps and profiles MAY change; the change applies to new sessions.
6.4.4 relayctl.snapshot and relayctl.ack
relayctl.snapshot payload: {"snapshots": [LeaseSnapshot, …]}, 1–256 LeaseSnapshots (15 §4.2), at most one per callId per message. Each names a call opened on this link.
The relay processes each snapshot N in order:
- If the call isn't open on this link: result
unknown_call. - If
Nbreaks the rules of 15 §4.2 (unsorted arrays, duplicates,audioorvideonot a subset oflisteners,epochpresent in an insecure call or absent in a secure one): resultinvalid, and the relay keeps its current snapshot. - If
N.seq≤ theseqof the snapshot it holds, and that snapshot was received less than 3,000 ms ago on the relay's monotonic clock: resultstale. Once the held snapshot is 3,000 ms old or older, the relay goes on to step 4 whateverN.seqis (15 §4.5). - Otherwise it applies
Nat once, records the receipt time on its monotonic clock (15 §4.5), and emitsNas the control-channel messagecall.tickto every session of the call, SHOULD do so within 50 ms, and skips the tick for any session whose control channel can't take it within 250 ms of receiving the snapshot (15 §4.4). Resultapplied.
relayctl.ack payload: {"acks": [{"callId", "seq", "result", "heldSeq"}, …]}. result is applied, stale, unknown_call or invalid; heldSeq is the seq of the snapshot the relay holds after processing (null if none). The relay sends the ack within 100 ms of processing and MAY combine acks produced within 20 ms of each other. Call control treats an unknown result as invalid.
On unknown_call, call control sends relayctl.call_open and the newest snapshot. On invalid, it records an error (it is a bug on one side) and sends the newest snapshot again with a higher seq.
6.4.5 relayctl.session_close
| Member | Type | Required | Meaning |
|---|---|---|---|
callId |
string | Yes | The call. |
pid |
integer | Yes | The participant whose session to close. |
reason |
string | Yes | The relay.closing reason to send (15 §6.6): left, removed, revoked, moved, switched, call_ended, call_restarted, session_expired, drain, timeout or overloaded. A relay passes a value it doesn't know through unchanged; clients treat an unknown reason as an unexpected drop (15 §6.6). |
retryAfterMs |
integer | No | Passed through in relay.closing. |
The relay at once stops forwarding anything to or from that session, sends relay.closing with reason and retryAfterMs on its control channel, and closes the peer connection after the message is flushed or 1,000 ms, whichever comes first. It then sends relayctl.session_down with reason instructed. If it has no session for (callId, pid), it does nothing.
Call control sends relayctl.session_close for every seat removal (15 §2.6, §4.5), with the seat's removal reason as reason, except that the seat removals of a call that ended with security_upgraded or group_restarted use call_restarted (15 §2.6), within 500 ms of the decision and after the snapshot that removes the pid. Lease enforcement doesn't depend on it: the snapshot alone already stops forwarding (15 §4.5).
6.4.6 relayctl.call_drain
Payload: {"callId": …, "deadlineMs": 10000}. Starts the old relay's part of a planned relay migration (15 §6.9). The relay:
- sends
relay.closingwith reasondrainandretryAfterMs: 0to every session of the call; - keeps forwarding normally, under the snapshots call control keeps sending during the migration window (15 §6.9 steps 1 and 5);
- at
deadlineMsafter receiving the message, closes every remaining session of the call without a furtherrelay.closing, reporting each withrelayctl.session_downreasondrain_deadline; - keeps the call state until
relayctl.call_closearrives, or until 15 s after the deadline with no snapshot, then frees it.
deadlineMs is 10,000 in this version (15 §6.9 step 4). A relay treats any other value as 10,000.
6.4.7 relayctl.call_close
Payload: {"callId": …, "reason": …} with reason:
reason |
Meaning | Relay action for remaining sessions |
|---|---|---|
ended |
The call ended for a reason that 15 §10.1 makes terminal (15 §2.4): any reason other than security_upgraded, group_restarted and server_restart. |
relay.closing reason call_ended, then close. |
restarted |
The call ended with security_upgraded or group_restarted, and a new call replaces it (15 §12.1, §12.5). |
relay.closing reason call_restarted, then close. |
migrated |
The call now lives on another relay. | relay.closing reason drain, retryAfterMs: 0, then close. |
lost |
Call control lost the call's state and ended it with reason server_restart (15 §4.3 rule 3, §10.1). |
relay.closing reason timeout, then close. |
unknown |
Call control has no record of the call (after a resynchronisation). | relay.closing reason timeout, then close. |
Call control MUST use lost, never ended, for a call it ended with server_restart. It MUST likewise use restarted, never ended, for a call that ended with security_upgraded or group_restarted. These ends are planned migrations (15 §10.1), and call_ended would make clients leave for good. server_restart is an unexpected drop that clients repair with a fresh join (15 §10.1, D-012), and the relay's relay.closing must not contradict that: call_ended is terminal, timeout isn't. A call with no record at call control is, by definition, a call whose state was lost, so unknown behaves the same way.
An unknown reason is treated as unknown. The relay then frees the call's state, including its replay cache entries for tickets of that call once they have expired (15 §5.2 step 6).
6.5 Relay reports
6.5.1 relayctl.session_up
Sent when the relay has created a session and sent relay.welcome and the first call.tick on it (15 §6.6), within 100 ms.
| Member | Type | Required | Meaning |
|---|---|---|---|
callId |
string | Yes | From the ticket's cid. |
pid |
integer | Yes | From the ticket. |
did |
string | Yes | From the ticket. |
sub |
string | Yes | From the ticket. |
relaySessionId |
string | Yes | As returned to the client (15 §6.2), at most 64 characters. |
iceTcp |
boolean | Yes | The session uses ICE-TCP. For capacity planning only. |
upAt |
string | Yes | RFC 3339. |
Call control checks that a seat with this pid exists in the call and belongs to device did. If it does, it records (relayId, relaySessionId) as the seat's current session and applies the seat transition of 15 §2.6 ("relay reports the session up"). If it doesn't, it sends relayctl.session_close with reason revoked and records a security diagnostic: a ticket was used for a seat that doesn't match it.
When a new session replaces an older one for the same (callId, pid) on the same relay (15 §5.2), the relay MUST send relayctl.session_up for the new session before relayctl.session_down with reason replaced for the old one.
6.5.2 relayctl.session_down
| Member | Type | Required | Meaning |
|---|---|---|---|
callId |
string | Yes | |
pid |
integer | Yes | |
relaySessionId |
string | Yes | The session that ended. |
reason |
string | Yes | See below. Unknown values: treat as transport_closed. |
downAt |
string | Yes | RFC 3339. |
reason |
When | Call control action |
|---|---|---|
client_gone |
10 s without any packet from the client (15 §6.7 rule 3) | Seat → reconnecting (15 §2.6) |
transport_closed |
ICE failed, or the DTLS or SCTP association closed | Seat → reconnecting |
overloaded |
The relay shed the session under load | Seat → reconnecting; consider the relay full |
relay_shutdown |
The relay is stopping without a drain | Seat → reconnecting |
drain_deadline |
§6.4.6 step 3 | Seat → reconnecting unless the seat already moved to the new relay |
key_revoked |
The session was opened with a ticket signed by a key that has since been revoked (§6.7 rule 4) | As for the old relay's sessions in a failover: the migration-window rule of §6.9.3 |
replaced |
A newer session for the same (callId, pid) replaced this one (15 §5.2) |
None: call control records it and never changes seat state on it. The newer session has already reported session_up. |
instructed |
After relayctl.session_close |
None |
Call control identifies a session by (relayId, relaySessionId), because a relaySessionId is unique only within one relay (15 §6.2). A relayctl.session_down whose (relayId, relaySessionId) isn't the seat's current session (§6.5.1) is ignored, so a late report about a replaced session, or a report from the old relay of a migration, can't mark a live seat reconnecting.
6.5.3 relayctl.load
Sent every 5,000 ms, and at once when state changes.
| Member | Type | Required | Meaning |
|---|---|---|---|
state |
string | Yes | accepting (may receive new calls), full (keep existing calls, assign no new ones) or draining (migrate existing calls away, §6.9). Unknown: treat as full. |
sessions |
integer | Yes | Open sessions on this link's issuer. |
sessionsTotal |
integer | Yes | Open sessions on the node, all issuers. |
calls |
integer | Yes | Open calls on this link. |
ingressKbps, egressKbps |
integer | Yes | Node totals over the last 5 s. |
cpuPermille |
integer | No | Node CPU use, 0–1000 per core-equivalent of capacity. |
dropPermille |
integer | Yes | Media messages dropped for queue or lateness reasons (16 §8.1), per thousand forwarded, over the last 5 s. |
6.5.4 relayctl.call_stats
Sent every 5,000 ms, listing each call open on the link in which at least one session subscribes (relay.subscribe) to source 1 or 3. Payload {"calls": [{"callId": string, "videoPairs": integer, "videoPairsDegraded": integer}, …]}, at most 256 entries per message (send several messages if needed). videoPairs is the number of (viewer, source) pairs for sources 1 and 3 that the relay currently serves (17 §8.2). videoPairsDegraded is how many of them are in a viewer state other than normal. Call control uses them for 17 §13.2 items 2 and 3. Unknown members are ignored.
6.6 Snapshot delivery requirements
These requirements make the timing of 15 §4.8 hold across the link.
- Call control sends every snapshot of a call (15 §4.3) to every relay node that has the call open; during a migration, to both (15 §6.9).
- A snapshot that changes a list (an "immediate" snapshot, 15 §4.3 rule 2) MUST be written to the link without waiting to batch. Periodic snapshots MAY be combined into one
relayctl.snapshotwith others produced within 50 ms. - Don't send late. Call control MUST NOT write a snapshot to the link more than 250 ms after producing it (on a deployment with a link holder, §6.2.1 rule 4, after the owner produced it); it discards it instead, and the next periodic or immediate snapshot of that call takes its place. It MUST write an immediate snapshot within 500 ms of the decision that caused it (15 §4.3, §6.2.1 rule 4). Call control SHOULD keep the link's socket send buffer small (for example at most 64 KiB) so that little can wait below the point where it applies this rule. A link that hasn't accepted a write for 3,000 ms is closed with 4008 and enters
suspect(§6.8). This mirrors 15 §4.4's rule forcall.tick: the relay measures a snapshot's age from its arrival, so a snapshot that waited in a queue would look fresh. With this rule a relay's 3 s window starts no later than about 250 ms plus network delay after the snapshot was produced, which 15 §4.8 counts in its cut-off; and a link stalled for longer is closed by the relay's own 3 s silence rule (§6.8), which discards whatever was still in flight. - Call control MUST NOT send a snapshot for a call before
relayctl.call_openfor it on that link. - A snapshot counts as acknowledged by a relay node when call control has received, for that call, an ack with
resultappliedandseq≥ the snapshot'sseq, orstalewithheldSeq≥ it. For Move voice here (15 §11 step 3), a snapshot counts as acknowledged by the call's relay only when every relay node that has the call open on a link has acknowledged it (during a migration, both relays), or when 3,000 ms have passed since the last snapshot that listed the movedpidwas sent. - Snapshots aren't queued across a link loss. After a resynchronisation, call control sends only the newest snapshot of each call.
6.7 Keys and RelayTicket validation
- A relay validates RelayTickets exactly as 15 §5.2 says. For step 2 it uses the key set of the link that opened the call named by the ticket's
cid, whose issuer must equal the ticket'siss(§6.2.2 binds each link to one issuer, and a relay holds one link per issuer); this is the key set "its hosting server configured for it" that 04 allows. A relay MAY instead (or as well) fetch ServerMetadata and apply 02 §11.6, but when it has a link key set for the issuer, the link key set wins. - In addition to 15 §5.2, the relay MUST reject, with
relay.ticket_invalid, a ticket whosectxorsecdiffers from thectxorsecurityof that call'srelayctl.call_open. A ticket is only accepted for the call it was issued for. - A key is usable for a ticket exactly when 02 §11.6 step 5 says so (15 §5.2 step 2). Its
purposeissign. Itsstatusisactive,nextwithnow ≥ nbf, orretiredwith the ticket'siat≤retiredAt. Its thumbprint isn't inrevoked,now ≤ expand the ticket'siat ≥ nbf. Each comparison allows ±60 s (00 §7.7). - Revocation. When a key is revoked (§8.4), relays reject new tickets signed by it at once (they receive the revocation within 1,000 ms, §6.4.2). A relay MUST remember, for each open session, the thumbprint of the key that signed its ticket. When a
relayctl.keys(or a new link's welcome) adds a thumbprint torevoked, the relay MUST close every session whose ticket that key signed, whatever the ticket'siat(a stolen key can sign anyiat), sendingrelay.closingwith reasondrainandretryAfterMs: 0, and report each withrelayctl.session_downreasonkey_revoked. Honest clients then rejoin as a planned migration with a ticket signed by the new key and keep their mic and push-to-talk state (15 §6.9, §10.1); a session opened with a forged ticket has no rejoin token and can't come back. - A relay that has no link for a ticket's
iss, and doesn't fetch metadata, answersrelay.ticket_invalid(15 §5.2 step 2).
Rationale for rule 2 of §6.4.2: a relay that doesn't yet hold a new key, or holds it as next before its nbf, would reject the first tickets signed by it (02 §11.6 step 5). Making sure every relay holds the key in a usable state before control uses it removes the race.
Rationale for rule 4: a ticket only authenticates the /connect request, so without it a session opened with a forged ticket between rvt and the revocation would stay open as long as the seat it took over; in an insecure call it would keep hearing, seeing and speaking as that participant. Closing as drain rather than timeout keeps the cost for honest participants to a short gap.
6.8 Link lifecycle, failure and resynchronisation
Heartbeat. Call control sends relayctl.ping with {"n": integer} every heartbeatMs (1,000 ms). The relay answers relayctl.pong with the same n at once.
Relay side.
| State | Event | Action | Next state |
|---|---|---|---|
connecting |
Handshake and relayctl.welcome received |
Apply keys; await resynchronisation messages | linked |
connecting |
Handshake fails | Wait per the retry schedule | connecting |
linked |
No message from control for 3,000 ms, or the socket closes | Close the socket (4008 on timeout); keep all sessions and calls of this issuer; start retrying | lost |
lost |
Reconnected and welcomed | hello.calls lists every call still held |
linked |
lost |
30 s in lost |
Close every session of this issuer's calls without relay.closing, reporting them later if the link returns; free the calls |
lost |
Retry schedule: 250 ms, 500 ms, 1 s, 2 s, then every 2 s, each with ±20 % random jitter. While lost, forwarding stops by itself 3 s after each call's last snapshot (15 §4.5 rule 1); the relay MAY still accept /connect for a call whose snapshot is fresh.
Call control side, per link:
| State | Event | Action | Next state |
|---|---|---|---|
linked |
Socket closed or reset | Assign no new calls to the relay; note t0 = now |
suspect |
linked |
No relayctl.pong for 3,000 ms; or no write accepted for 3,000 ms (§6.6 rule 3); or no relayctl.keys_ack within 2,000 ms (§6.4.2 rule 3) |
Close with 4008; note t0 = now |
suspect |
suspect |
The same relayId links again within 1,000 ms of t0 |
Resynchronise (§6.4.1) | linked |
suspect |
1,000 ms after t0 |
Fail over every call on the relay (§6.9.3) | failed |
failed |
The relayId links again |
Resynchronise: relayctl.call_close (migrated) for every call that moved |
linked |
Rationale: a crashed relay node usually resets its TCP connections, so call control notices within milliseconds and fails calls over in about 1 s, before clients notice on their own (5 s, 15 §6.7). Clients then move as a planned migration rather than an outage. A hung node is noticed within 3 s and failed over within 4 s.
6.9 Drains, rebalancing and failover
6.9.1 Draining a relay node (maintenance)
- The operator tells the relay to drain (implementation-specific: a signal, an admin command). The relay sends
relayctl.loadwithstate: "draining"on every link. - Call control stops assigning new calls to it and migrates each of its calls to another relay with 15 §6.9:
relayctl.call_openand snapshots to the new relay,call.migrate(reasondrain) to participants, andrelayctl.call_drainto the old relay. It SHOULD pace migrations at no more than 20 calls per second per relay, so participants' rejoins don't arrive all at once. - After the 10 s window of each migration, call control sends
relayctl.call_close(migrated) to the old relay. - When the relay has no calls on any link, it closes its links with 1001 and the operator stops it.
UX: nobody hears a gap and nobody sees "reconnecting": a drain is a planned migration (15 §10.8). Mic and push-to-talk state are kept.
6.9.2 Rebalancing
Call control MAY migrate a call for load or proximity with the same procedure and call.migrate reason rebalance. It SHOULD NOT migrate one call more than once per 10 minutes.
6.9.3 Failover
When a link enters failed (§6.8), call control, for each call on that relay:
- picks another relay (§6.10). If none can take the call, it keeps the call, applies to every
connectedseat whose session was on the failed relay the transition "relay reports the session down" of 15 §2.6 withlostAt= the failover time, and answers rejoins withcall.relay_unavailable(15 §16.1) until a relay is available. Seats whose devices don't come back are removed withtimeout30 s afterlostAt, and the call ends by 15 §2.4 (emptyorcompleted) if no one remains; - sends
relayctl.call_openand the newest snapshot to the new relay and makes it the call's relay, so every later join and rejoin response carries its URL (15 §3.3.3); - sends
call.migrate(reasondrain) to every participant (15 §6.9); clients rejoin withplanned: trueand connect to the new relay; - treats the old relay's sessions as gone: it doesn't wait for their
session_down, which may never come. It applies the migration-window rule: aconnectedseat whose session was on the failed relay staysconnectedfor the 10 s migration window of 15 §6.9; if the new relay hasn't reported a session up for it (§6.5.1) by the end of the window, call control applies the transition "relay reports the session down" of 15 §2.6 withlostAt= the failover time. The seat then follows 15's 30 sreconnectingtimer, so a device that crashed or lost its network at the same moment can't keep a seat, or a 1:1 call, alive for ever.
The same migration-window rule applies to sessions that a relay closes because their ticket's key was revoked (session_down reason key_revoked, §6.7 rule 4), with lostAt = the downAt of the report.
Call control MAY pace failovers to protect its join path, but SHOULD NOT go slower than 200 calls per second, because every second of delay is a second in which participants hear nothing.
A failover started by call control is a planned migration: it is the "server-requested failover" of 00 HP-13 item 7, and clients treat call.migrate as planned (15 §10.1), so mic mode, self-mute and push-to-talk state are kept. A client that detected the failure itself before call.migrate arrived is, under 15 §10.1, in an unexpected drop and follows 15 §10. Call control's 1 s detection (§6.8) is well inside the clients' 5 s (15 §6.7), so this is rare.
UX: listeners hear a gap of about 1–4 s. During it, a user holding push-to-talk has no route up, so the transmit gate is closed and the talk indicator says plainly that they aren't being heard (15 §10.6 rules 1 and 5) until the new relay's first tick arrives. Audio from the gap is discarded, never sent late (D-012). Everything else about mic and push-to-talk state is kept.
6.10 Relay assignment (informative policy)
Call control chooses a relay for a new call (15 §3.3.2 step 5) among relay nodes that are linked and accepting. A reasonable policy:
- Prefer the region closest to the first joiner (by the client's IP geolocation, or by the region of the API node that received the join).
- Among those, pick the node with the lowest
max(sessionsTotal / maxSessions, egressKbps / maxEgressKbps)from its latestrelayctl.load, skipping nodes above 0.8. - If no node qualifies, use another region; if none at all, refuse the join with
call.relay_unavailable(503,wait).
DM calls, 1:1 and group, are relayed exactly like channel calls (D-094), so plan relay capacity for DM call media as well.
6.11 Relays shared by several servers, and cascading
Several issuers. A relay node MAY serve several hosting servers (02 §14, §3.4). Then:
- It opens one control link per issuer, each with its own credential and its own configured issuer (§6.2.2).
- It keys every call by (issuer,
callId), where the issuer is the configured issuer of the link that sentrelayctl.call_open. A message on one link can never affect a call of another link. - A RelayTicket opens a session only in a call of the link whose issuer equals the ticket's
iss, and is validated only with that link's key set (§6.7 rule 1); with no such call, the relay waits up to 2,000 ms and answersrelay.call_unknown(15 §5.2 step 7). - URLs MAY be shared between issuers; the
audcheck (15 §5.2 step 4) is per node.
Cascading (one logical relay URL over several relay nodes, 15 §6.1 rule 1) is OPTIONAL and NOT RECOMMENDED: an SFU (§7) is the better tool for very large video calls. A deployment that cascades MUST keep every rule of 15 true for the logical relay as a whole:
- Every node that forwards any message of a call holds that call's snapshots itself and applies 15 §4.5, including the 3 s rule, on its own clock. Each call has exactly one anchor node in the cascade, which holds the only control link on which that call is open. Call control sends the call's snapshots and instructions only to it, and it relays them to the other nodes in
seqorder. Call control never learns the cascade's layout. - The anchor node acknowledges a snapshot (§6.6 rule 5) only when every node holding sessions of the call has applied it. It applies §6.6 rule 3 to the copies it relays: a node discards a relayed snapshot that is more than 250 ms old.
- A ticket's
jtiis single use, and there is at most one session per (cid,pid), across all nodes (15 §5.2 steps 6 and following). - Links between nodes are authenticated, encrypted when they leave a trusted network, and carry each message's sending
pidas validated by the node that holds the sender's session. A node forwards a message from another node only if the sender is covered in its own newest snapshot. - Per-recipient independence (16 §8.1) holds end to end: a congested link between nodes never delays recipients on other nodes or other recipients on the same node.
relayctl.session_upandrelayctl.session_downare reported once per session, through the call's anchor node, with onerelaySessionIdspace for the whole logical relay.
6.12 Metrics
Relays and call control SHOULD export the metrics below, for example in OpenMetrics text format. Names are RECOMMENDED so that shared dashboards work across implementations. Labels MUST NOT include addresses, device IDs, pids, callIds, IP addresses or anything else that identifies a person; issuer (a server's canonical domain) and the enumerated reason, result and channel labels are allowed.
Relay:
| Metric | Type | Labels | Meaning |
|---|---|---|---|
sv_relay_sessions |
gauge | issuer |
Open sessions. |
sv_relay_calls |
gauge | issuer |
Open calls. |
sv_relay_connect_total |
counter | issuer, result |
/connect outcomes: ok, ticket_invalid, ticket_expired, ticket_replayed, wrong_relay, call_unknown, bad_offer, overloaded. |
sv_relay_forwarded_total |
counter | channel |
Messages forwarded, per recipient: audio, video, control. |
sv_relay_dropped_total |
counter | reason |
Messages dropped: not_covered (15 §4.5 rule 3), snapshot_stale (rule 1), pid_mismatch (rule 2), mode_mismatch (16 §4.9.2), malformed, inbound_cap (16 §8.1, 17 §8.3, 15 §6.6), queue_full and too_late (16 §8.1, counted per recipient and exported in aggregate), video_congestion, video_need_key and video_expired (17 §8.2: congestion drops, drops while needKey, and fragments discarded after 500 ms in a viewer's queue; counted per viewer and exported in aggregate). |
sv_relay_ingress_bytes_total, sv_relay_egress_bytes_total |
counter | — | Payload bytes. |
sv_relay_tick_delay_seconds |
histogram | — | From snapshot receipt to call.tick written to the last session. 15 §4.4 asks for ≤ 50 ms. |
sv_relay_calls_stale |
gauge | issuer |
Calls whose newest snapshot is 3 s old or more. Non-zero for long means control or the link is failing. |
sv_relay_session_down_total |
counter | reason |
§6.5.2 reasons. |
sv_relay_control_link_up |
gauge | issuer |
1 when the link is linked. |
Call control:
| Metric | Type | Meaning |
|---|---|---|
sv_callctl_snapshot_interval_seconds |
histogram | Gap between consecutive snapshots of one call; MUST stay within 0.9–1.1 s (15 §4.3). |
sv_callctl_revocation_push_seconds |
histogram | From a list-changing decision to writing the snapshot to the link; SHOULD be ≤ 0.1 s, MUST be ≤ 0.5 s. |
sv_callctl_snapshot_ack_seconds |
histogram | From sending a snapshot to its ack. |
sv_callctl_relay_failovers_total |
counter | Failovers of §6.9.3. |
sv_callctl_relay_unavailable_total |
counter | Joins refused with call.relay_unavailable. |
sv_callctl_calls, sv_callctl_seats |
gauge | Active calls and seats, by state. |
Federation and keys (06, 02): sv_fed_queue_depth{lane}, sv_fed_oldest_event_age_seconds{lane}, sv_fed_revocation_fanout_seconds (histogram against the 10 s target of 06 §11.3), sv_fed_peers_suspended, sv_keys_active_expiry_seconds{purpose} (time to the active key's exp; alert with the key-expiry rule of §9.2).
6.13 Example transcript
A relay node starts and registers with b.com, a call is opened, a participant connects, is muted for everyone, and leaves. Header members other than t and d are shortened after the first message.
{ "v": 1, "t": "relayctl.hello", "id": "01938f3e-0001-7000-8000-000000000001", "ts": "2026-12-04T18:19:58.001Z",
"d": { "relayId": "fra-1", "protocol": "1.0", "urls": ["https://relay1.b.com/r"],
"software": "pion-relay/0.9.2", "region": "eu-central",
"capacity": { "maxSessions": 4000, "maxEgressKbps": 900000 },
"state": "accepting", "calls": [] } }{ "v": 1, "t": "relayctl.welcome", "id": "01938f3e-0002-7000-8000-000000000002",
"re": "01938f3e-0001-7000-8000-000000000001", "ts": "2026-12-04T18:19:58.010Z",
"d": { "issuer": "b.com", "protocol": "1.0", "linkId": "01938f3e-0003-7000-8000-000000000003",
"keysVersion": 7,
"keys": [ { "kty": "OKP", "crv": "Ed25519", "x": "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo",
"kid": "b.com#2026-12a", "purpose": "sign", "status": "active",
"nbf": 1764720000, "exp": 1796256000 } ],
"revoked": [], "heartbeatMs": 1000, "maxInboundKbps": 10000 } }{ "v": 1, "t": "relayctl.call_open", "id": "…", "ts": "2026-12-04T18:20:02.120Z",
"d": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "ctx": "ch:01938a11-2b3c-7d4e-8f90-112233445566",
"security": "secure", "url": "https://relay1.b.com/r", "profiles": ["voice-dc/1", "video-dc/1"] } }
{ "v": 1, "t": "relayctl.snapshot", "id": "…", "ts": "2026-12-04T18:20:02.121Z",
"d": { "snapshots": [ { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "seq": 1185, "validMs": 3000,
"audio": [3, 7], "video": [3, 7], "listeners": [3, 7], "epoch": 42 } ] } }
{ "v": 1, "t": "relayctl.ack", "id": "…", "ts": "2026-12-04T18:20:02.124Z",
"d": { "acks": [ { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "seq": 1185,
"result": "applied", "heldSeq": 1185 } ] } }
{ "v": 1, "t": "relayctl.session_up", "id": "…", "ts": "2026-12-04T18:20:02.611Z",
"d": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "pid": 7, "did": "q2bS9xVg3m0yJpQe1vT0Aw",
"sub": "alice@a.com", "relaySessionId": "r1-8f2c91", "iceTcp": false,
"upAt": "2026-12-04T18:20:02.610Z" } }A moderator mutes Alice for everyone; call control pushes an immediate snapshot without pid 7 in audio:
{ "v": 1, "t": "relayctl.snapshot", "id": "…", "ts": "2026-12-04T18:22:30.402Z",
"d": { "snapshots": [ { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "seq": 1334, "validMs": 3000,
"audio": [3], "video": [3, 7], "listeners": [3, 7], "epoch": 42 } ] } }Alice leaves:
{ "v": 1, "t": "relayctl.snapshot", "id": "…", "d": { "snapshots": [ { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465",
"seq": 1401, "validMs": 3000, "audio": [3], "video": [3], "listeners": [3], "epoch": 42 } ] } }
{ "v": 1, "t": "relayctl.session_close", "id": "…",
"d": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "pid": 7, "reason": "left" } }
{ "v": 1, "t": "relayctl.session_down", "id": "…",
"d": { "callId": "01938f40-5a6b-7c8d-9e0f-102132435465", "pid": 7, "relaySessionId": "r1-8f2c91",
"reason": "instructed", "downAt": "2026-12-04T18:23:59.210Z" } }6.14 Test vectors (behavioural)
Times are milliseconds on the relay's monotonic clock unless stated. "C" is call control, "R" the relay. Each vector is normative for the behaviour it shows.
RC-1: ordering and acknowledgement. Call X is open on R.
| Time | Input | R holds seq |
R sends |
|---|---|---|---|
| 0 | relayctl.snapshot X seq 10 |
10 | call.tick seq 10 to sessions; ack {X, 10, applied, 10} |
| 400 | relayctl.snapshot X seq 9 |
10 | ack {X, 9, stale, 10}; no tick |
| 500 | relayctl.snapshot X seq 12 with audio [4] and listeners [3] |
10 | ack {X, 12, invalid, 10} |
| 900 | relayctl.snapshot for call Y never opened |
— | ack {Y, …, unknown_call, null} |
| 3,100 | relayctl.snapshot X seq 5 (the held seq 10 was received at 0, 3,100 ms ago) |
5 | call.tick seq 5 to sessions; ack {X, 5, applied, 5} (15 §4.5: after 3,000 ms any seq is accepted) |
RC-2: issuer isolation. R has links L1 (issuer b.com) and L2 (issuer c.com). L1 opened call X. A client presents a valid RelayTicket with iss c.com and cid X. R finds no call X under c.com, waits 2,000 ms, and answers 404 relay.call_unknown. A relayctl.session_close for X received on L2 is ignored.
RC-3: link loss and relink. Call X's last snapshot arrives at R at 0; then the network between C and R drops every packet in both directions. Times are on R's clock; C's clock is taken as aligned for the illustration.
| Time | Event | Result |
|---|---|---|
| 2,999 | Audio frame from a covered sender | Forwarded |
| 3,000 | R: link declared lost (3,000 ms without a message). C: no relayctl.pong for 3,000 ms, so C closes with 4008, notes t0 = 3,000 and enters suspect (§6.8). Any frame at R |
Dropped (snapshot stale, 15 §4.5 rule 1); sessions stay open |
| 3,000 | The network recovers; R schedules its first retry 250 ms ± 20 % later (§6.8) | — |
| 3,240 | Link re-established; hello.calls = [X]; C is still within 1,000 ms of t0 |
C resynchronises: call_open X and its newest snapshot (say seq 1,190), plus call_open and the newest snapshot for every other call assigned to R (§6.4.1) |
| 3,260 | Snapshot applied | Forwarding resumes; ack {X, 1190, applied, 1190} |
Variant: if the relink happens after C's t0 + 1,000 ms (say at about 4,750, because the network recovered only after the retries at about 3,250 and 3,750 had failed), C has already failed X over to another relay (failed, §6.9.3), and at 4,750 it sends call_close X with reason migrated; R sends relay.closing drain to X's sessions that remain.
RC-4: key activation. R holds keysVersion 7, which lists b.com#2026-12a active and b.com#2027-01a next with nbf = T. Before T − 60 s, a ticket signed by 2027-01a fails with relay.ticket_invalid, because a next key is usable only from its nbf (02 §11.6 step 5). This is why §6.4.2 rule 2 forbids C to sign with it yet. At T, C starts signing with 2027-01a, which R already accepts. C then sends version 8 (2027-01a active, 2026-12a retired with retiredAt = T). From then on, R accepts a ticket signed by 2026-12a only if its iat is at most T + 60 s, and never after that key's exp.
RC-5: Move voice here. Alice holds pid 7 in call X on device D1 and joins with takeOver: true from D2. C sends snapshot seq 1,402 without 7 at time 0, and relayctl.session_close (7, moved) at time 2.
| Case | Ack received | C admits D2 at |
|---|---|---|
| A | {X, 1402, applied} at 6 |
6 |
| B | None (link lost) | 3,000 after the last snapshot that listed 7 was sent (15 §11 step 3) |
| C | {X, 1405, applied} at 1,010 (the link was re-established in between and 1,405 is the first snapshot after resynchronisation, §6.6 rule 6) |
1,010 |
RC-6: failover timing at C. The relay node crashes at 0 and its kernel resets the TCP connection at 5. C enters suspect at 5, failed at 1,005, and from 1,005 sends call.migrate for the relay's calls at no less than 200 calls per second (§6.9.3), so a relay with 400 calls is fully failed over by about 3,005. A relay that hangs without resetting is noticed at 3,000 (no pong) and failed over at 4,000. For a call failed over at 1,005, a connected seat whose device hasn't reported up on the new relay by 11,005 becomes reconnecting with lostAt 1,005 and is removed with timeout at 31,005 if the device never comes back (migration-window rule, §6.9.3).
RC-7: closing calls whose state was lost. C restarts and loses the state of call X; it ends X with server_restart (clients get call.ended). R links again with hello.calls = [X, Y]; Y is still assigned to R.
| Input at R | R sends to X's sessions |
Client class (15 §10.1) |
|---|---|---|
call_open Y and its newest snapshot |
— | — |
call_close X, reason lost (C has a record of ending it) or unknown (C has none) |
relay.closing reason timeout |
Unexpected drop: the client makes a fresh join (D-012) |
(wrong) call_close X, reason ended |
relay.closing reason call_ended |
Terminal: the client would leave for good, which is why C MUST NOT use ended here (§6.4.7) |
RC-8: a replaced session. Seat 7 of call X is connected with session (fra-1, r1-aa). The client notices a drop first and rejoins with planned: false, so C moves the seat to connecting (15 §2.6). R accepts the new ticket and opens session r1-bb. R sends session_up (7, r1-bb): C records (fra-1, r1-bb) and the seat becomes connected. R then sends session_down (7, r1-aa, replaced): C records it and changes nothing. A late session_down (7, r1-aa, transport_closed) is ignored, because r1-aa isn't the seat's current session.
7. The SFU adapter
7.1 Requirements (normative for SFU-capable servers)
The SFU adapter is part of call control. It turns the operations of 15 §8.5 into calls on a particular SFU. Whatever the SFU, the adapter (and, for rule 4, the SFU-capable server as a whole) MUST meet these rules:
- Hide the SFU from clients. Clients exchange SDP only with call control (15 §8.2). The SFU's own signalling, tokens and SDKs never reach clients, and no client needs a vendor library (D-009, §3.5).
- Apply every snapshot of an SFU-routed call as 15 §4.7 requires: forward a published track of
pidpand sourcekonly whilepis covered fork's list; send a subscriber nothing while it isn't inlisteners; make each change effective within 1,000 ms of the snapshot; and, if it can't confirm a change in that time, have call control close that participant's SFU session. - Dead-man rule. If the adapter gets no snapshot for a call for 3,000 ms, it pauses all forwarding for the call (
pauseCall) until snapshots resume. If the adapter runs in its own process, it MUST apply this rule itself, so that a call-control crash can't leave the SFU forwarding indefinitely. - The SFU can't outlive its adapter. An SFU-capable server MUST make sure that the SFU stops forwarding a call's media within 3,000 ms after the adapter stops delivering snapshots for it, including when the adapter itself has crashed. Acceptable ways are: running the adapter in the SFU's process (a Pion-based SFU, or the Node.js process that owns mediasoup workers); tying the SFU's lifetime to the adapter's (the SFU runs as the adapter's child process and is killed with it); or an SFU-side keepalive or session time-to-live that the adapter must refresh at least every 1,000 ms and that pauses or closes the call's sessions when it lapses. Process supervision that restarts a crashed adapter is useful but isn't enough on its own. Rationale: receiver-side coverage checks (15 §4.6) stop a revoked sender from being played, but nothing at the receiver stops a kicked or banned listener from receiving; only the SFU can, and only while something drives it.
- Pass secure media through untouched. In secure calls the SFU must forward SFrame-protected payloads without transcoding, re-packetising across frame boundaries, or modifying the encoded frame (the clear prefix and the SFrame ciphertext, 18 §8.4). It may read the clear prefix. As normal layer switching requires, it may read and rewrite the RTP header fields it manages (SSRC, sequence numbers, timestamps), the VP8 and VP9 RTP payload descriptors (picture ID, TL0PICIDX, layer indices) and the Dependency Descriptor header extension, which are unauthenticated forwarding hints (17 §12.4, §12.6 item 5; 18 §8.4.3). An SFU that needs to parse encrypted bytes for layer switching can't carry secure calls; the adapter MUST then refuse
sfurouting for secure calls (call control keepsvideoRouteatdc, 15 §7.2). - Keep sessions per device. One SFU session per participating device per call (15 §8.1 rule 2), closed with the reasons of 15 §15 (
sfu.closed). - Report events (session up and down, tracks published and unpublished) so call control can emit
sfu.tracks_changedandsfu.closed(15 §8.5). - Carry no media keys and log no media payloads.
7.2 Transport
The adapter's southbound transport is the SFU's native interface: an in-process library, an HTTP or WebSocket API, or RPC. This document defines no wire protocol for it. Where the adapter runs as a separate process from call control, the northbound interface between them is implementation-internal, but it MUST carry the operations of 15 §8.5 with the timings of 15 §4.7 and rules 3 and 4 of §7.1.
7.3 Mapping onto common SFUs (informative)
The tables map 15 §8.5 onto SFUs as they are commonly documented at the time of writing. APIs change: implementers MUST check the current documentation of the version they deploy. "Fit" notes call out where an SFU's model differs from 15.
Fit summary.
| SFU | One PeerConnection per device for publish and subscribe (15 §8.1 rule 2) | SDP offer/answer driven by the server side | Per-track forwarding switch | Layer selection | Payload passthrough for SFrame |
|---|---|---|---|---|---|
| Pion-based SFU (custom, Go) | Yes | Yes | Yes (stop writing to subscribers) | Yes (adapter-implemented) | Yes |
| mediasoup v3 | Yes (one WebRtcTransport may both produce and consume) | No: ORTC parameters; the adapter translates SDP | Yes (producer.pause(), consumer.pause()) |
Yes (consumer.setPreferredLayers) |
Yes, for codecs whose layer information stays readable (17) |
| Janus (VideoRoom plugin, 1.x) | No: publishers and subscribers use separate handles and PeerConnections | Yes (JSEP) | Yes (moderate mutes a publisher's stream by mid) |
Yes (configure with substream and temporal layer) |
Yes, with the publisher flagged for end-to-end encryption |
| LiveKit (open source) | No by default (publisher and subscriber PeerConnections) | No: LiveKit's own signalling protocol | Yes (MutePublishedTrack) |
Yes (subscriber quality settings) | Yes (it supports encoded-transform E2EE) |
| Cloudflare Realtime SFU (hosted, one option) | Yes (a session is one PeerConnection that pushes and pulls tracks) | Yes (sessions and tracks REST API) | Indirect (close and re-pull tracks) | Simulcast preferences, per current API | Yes |
Janus VideoRoom and LiveKit fit 15 only through a signalling bridge that is out of proportion to their benefit, or through a change to 15 allowing two SFU sessions per device; OQ-21-2 raises this.
7.4 Pion-based SFU
An SFU written with Pion (pion/webrtc plus its interceptors for NACK, RTCP reports, TWCC and simulcast) inside the server or as a sidecar is the closest fit and the RECOMMENDED starting point for self-hosters.
| 15 §8.5 operation | Implementation |
|---|---|
createSession(callId, pid, offer, publish) |
New PeerConnection for the device; SetRemoteDescription(offer); for each publish entry, bind the transceiver mid to (pid, sourceId); OnTrack registers each TrackRemote (one per RID for simulcast); CreateAnswer, gather candidates (ICE-lite or full), return answer and tracks. |
renegotiate |
Same, on the existing PeerConnection. |
serverOffer, applyAnswer |
AddTransceiverFromTrack with a TrackLocalStaticRTP per subscribed (pid, sourceId); CreateOffer; on answer, SetRemoteDescription. |
setSubscriptions(session, want) |
Add or remove local tracks to match want; select the RID or SVC layer per maxSpatialLayer and maxTemporalLayer; request a keyframe (PLI) from the publisher when switching layers. |
setForwarding(callId, pid, sourceId, enabled) |
Gate the forwarding loop that reads the publisher's TrackRemote and writes to subscribers' TrackLocals. Confirmation is immediate. |
setReceiving(callId, pid, enabled) |
Gate every write to that subscriber's local tracks. |
closeSession |
PeerConnection.Close(). |
pauseCall, resumeCall |
One flag per call checked by every forwarding loop. |
| Events | OnConnectionStateChange, OnTrack, track end. |
7.5 mediasoup
| 15 §8.5 operation | mediasoup v3 |
|---|---|
| Per call | One Router per call on a Worker (worker.createRouter({ mediaCodecs })). Large deployments pipe producers between routers on different workers or hosts (router.pipeToRouter); the rules of §6.11 about consistent enforcement apply to piped producers as well. |
createSession |
router.createWebRtcTransport(...) (or with a shared WebRtcServer for one UDP port); translate the client's SDP offer into transport.connect({ dtlsParameters }) and one transport.produce({ kind, rtpParameters, appData: { pid, sourceId } }) per published mid; build the SDP answer from the transport's ICE and DTLS parameters. A server-side SDP-to-ORTC translation layer is required. |
serverOffer / applyAnswer |
transport.consume({ producerId, rtpCapabilities, paused: true }) per subscribed track; build an SDP offer; on answer, consumer.resume(). |
setSubscriptions |
Create or close consumers; consumer.setPreferredLayers({ spatialLayer, temporalLayer }). |
setForwarding(…, false) / true |
producer.pause() / producer.resume(). Confirmation: the returned promise resolves. |
setReceiving(…, false) / true |
consumer.pause() / consumer.resume() for every consumer on the subscriber's transport. |
closeSession |
transport.close(). |
pauseCall / resumeCall |
Pause or resume every producer in the router. |
| Events | transport.on('dtlsstatechange'), transport.on('icestatechange'), producer and consumer close events, the router's observer. |
7.6 Janus, LiveKit and Cloudflare Realtime SFU
Janus VideoRoom. A publisher handle joins with {"request": "joinandconfigure", "ptype": "publisher", …} and the client's JSEP offer; a subscriber handle joins with {"request": "join", "ptype": "subscriber", "streams": [{feed, mid}…]}, Janus offers, and the answer goes back with {"request": "start"}. {"request": "moderate", "mid": …, "mute": true} stops a publisher's stream (setForwarding); {"request": "configure", "substream": …, "temporal": …} selects layers; {"request": "kick"} ends a session; "e2ee": true on the publisher tells Janus not to inspect payloads. The two-handle model needs two PeerConnections per device, which 15 §8.1 rule 2 doesn't allow today.
LiveKit. Server control goes through its RoomService API: MutePublishedTrack (setForwarding), UpdateSubscriptions (setSubscriptions), RemoveParticipant (closeSession). Clients normally join with LiveKit's own signalling and SDKs, which 15 §8.1 rule 1 forbids; the adapter would have to speak LiveKit's signalling protocol on each client's behalf and bridge it to 15's SDP exchange, and LiveKit's default two-PeerConnection model meets the same obstacle as Janus.
Cloudflare Realtime SFU (one option, D-009). The adapter is the "application server" of that service. POST …/sessions/new creates a session (one PeerConnection); POST …/sessions/{id}/tracks/new with the client's offer and location: "local" tracks publishes them and returns the answer; the same call with location: "remote" tracks (naming the publisher's session and track) pulls them for a subscriber and may return an offer that needs PUT …/sessions/{id}/renegotiate with the client's answer (15's sfu.offer flow); PUT …/sessions/{id}/tracks/close closes tracks. Lease enforcement (setForwarding) closes the revoked publisher's pulled tracks at every subscriber and re-pulls them on a grant; because this costs one API call per subscriber, the adapter must batch and parallelise to stay within 1,000 ms (§7.1 rule 2) and, failing that, close the subscriber's session. A hosted SFU can't share the adapter's process, so it meets §7.1 rule 4 only through a session time-to-live in its API, or by running the adapter replicated so that a surviving replica closes a failed replica's sessions within 3,000 ms; check this before relying on it. A self-hosted SFU from §7.4 or §7.5 can replace it at any time without client changes.
7.7 Choosing whether to run an SFU
| Situation | Recommendation |
|---|---|
| Small communities, mostly voice | No SFU. video-dc/1 through the relay is enough (Profile S). |
| Regular screen shares to more than about 8 viewers, or webcam grids | Run an SFU; 15 §7.2 switches videoRoute automatically. |
| Secure calls with video for large groups | An SFU that passes SFrame payloads through (§7.1 rule 5). |
| Operator can't run UDP services beyond the relay | No SFU; rely on the relay. |
8. Server keys: rotation and compromise runbooks
These runbooks apply 02 §11 and §12 (key lifecycle, KeyRotation, keyChain), 13's external-sender rotation and §6.7 of this document. Times are examples.
8.1 Key custody
- Generate keys with a cryptographically secure generator (00 §7.15), inside the HSM or KMS where possible, and never put private keys in the main database or its backups (04, 02 §15.4).
- Keep one
signkey and onemls-external-senderkeyactive(02 §11.3). Keep a standbysignkey published as the one allowednextkey (02 §11.5 rule 4) with its private part stored apart from the active key, for example offline or in a second HSM partition (02 §11.7). Peers pin it like any key, so if the active key is compromised the standby takes over without any peer suspending federation. - Key state lives with the keys. The published key set (each key with its
status,nbf,expandrvt), the fullkeyChainand the highest KeyRotationnissued are kept in the key service or the security journal (§11.6.1), never only in the main database, so that a database restore can't roll them back (§11.6.4 step 1, 02 §12.2). - Limit who and what can sign: only the signing service holds key handles; API nodes ask it to sign. Log every signing operation's type (not its content) for incident analysis.
- Monitor the active keys'
exp: 02 §11.4 requires every active key'sexpto stay later than now + 7 days + 25 h. Alert with the key-expiry rule of §9.2: warn at 30 days, page at 8 days and 1 hour (7 days + 25 h, the last moment a rotation can still start in time).
8.2 R1: routine rotation of the sign key (by promoting the standby)
Let K1 be the active key, K2 the standby (published as next for more than 25 h), and T the chosen activation time.
| When | Step | Check |
|---|---|---|
Any time ≥ 25 h before T |
K2 is already in keys as next with nbf ≤ T and in keyChain through its KeyRotation (02 §12.1, signed by K1 when K2 was added). |
GET {base}/meta from outside your network lists K2; the self-check (02 §15.3) passes. |
T − 5 min |
Confirm that every linked relay has acknowledged a keysVersion that lists K2 as next with nbf ≤ T (sent when K2 was published, §6.4.2 rule 1). Send relayctl.keys again to any relay that hasn't, and wait for every relayctl.keys_ack (§6.4.2). |
Every linked relay acknowledged; a relay that didn't within 2,000 ms has been closed and its calls failed over (§6.4.2 rule 3). If many relays fail this way, stop and investigate before T. |
T |
In ServerMetadata: K2 active; K1 retired with retiredAt = T and exp ≥ T + 7 days (D-030). Start signing every JWS (HomeAssertion, S2S token, IdentityState, RelayTicket, KeyRotation) with K2. Send relayctl.keys with the same statuses to every linked relay (§6.4.2 rule 1). Relays already accept K2 as a next key whose nbf has passed. Purge or revalidate any CDN or shared cache in front of /meta, then send discovery.metadata_changed (02 §16.1). |
New tokens carry kid …#K2; peers' key-lookup failure rates stay flat (06 data.reason key_unknown and key_status, or discovery.unknown_key and discovery.key_unusable where no owner code applies). |
T + 1 min |
Generate the next standby K3; publish it as next with nbf ≥ now + 25 h, with a KeyRotation n + 1 signed by K2 whose url is the base URL named by the highest element of keyChain (the new base URL if a move is under way, 02 §12.1, §15.6). |
keyChain is contiguous, at most 64 entries, and covers every rotation of the last 400 days (02 §12.2). |
T + 7 days |
K1 passes exp. Remove it from keys within 30 days and destroy its private key. |
Why promote a standby rather than introduce a new key at T: a standby has been pinned by peers for weeks, so even peers whose metadata cache is stale accept it, and the rotation exercises the emergency path regularly.
UX: nobody sees anything (00 §4.12.5 lists server key rotation as never-prompt).
8.3 R2: routine rotation of the mls-external-sender key
- At least 25 h before
T, publish the new keyM2asnextwith a KeyRotation signed by the activesignkey (02 §12.1), whoseurlis the base URL named by the highest element ofkeyChain(the new base URL if a move is under way, 02 §12.1, §15.6). - At
T, makeM2activeand the old keyM1retired(exp ≥T+ 7 days). The server then sends, in every current secure group, the GroupContextExtensions proposal signed byM1that replaces the external-sender entry withM2(13). These proposals don't freeze groups; they are committed by the next member commit or through commit duty. - Monitor the number of groups still naming
M1. Dormant groups stay joinable afterM1expires through 13's exception for a pending replacement proposal; nothing else is needed. - Rotate this key at most every few months: each rotation causes one commit in every active group.
8.4 R3: the sign key is compromised
Goal: stop accepting the compromised key everywhere within 1 h of detection.
- Contain. Disable the key in the HSM or KMS. Decide
rvt: the earliest moment the key may have been exposed (02 §11.1); if unknown, the time of the oldest backup or host image that could have contained it. - Activate a replacement. If a standby exists, make it
activeat once (the 25 h rule is waived, 02 §11.7). Otherwise generate a new key and make itactive; it has no KeyRotation, because a revoked key can't vouch for its successor (02 §12.3, PD-02-9). Neither this step nor step 4 waits on an unresponsive relay: §6.4.2 rule 3 removes such a relay from the count within about 3 s. - Publish. In ServerMetadata, list the compromised key as
revokedwithrvt; purge or revalidate any CDN or shared cache in front of/meta, then senddiscovery.metadata_changedwithurgent: trueto peers within 10 s and to every open socket (02 §16.1). - Relays. Send
relayctl.keyswith the key inrevokedand the replacementactive; relays refuse new tickets signed by the revoked key immediately and close every session opened with one, as a planned migration for honest participants (§6.7 rule 4). - Re-sign IdentityStates. Re-sign every account's IdentityState with the new key at once. A refresh with unchanged content keeps
ver(07 §7.3). Verifiers that learn of the revocation stop accepting IdentityStates signed by the old key (02 §11.7), so this restores DM validation and channel admission quickly. - Expect suspensions. Peers that pinned the server under
dns-onlyevidence and had never seen the replacement key suspend federation (02 §10.2) until their admins accept the new key set or the server shows strong evidence. Publishing/.well-known/sloppyv(if delegation is cross-site) giveswellknownevidence and lets those peers resume by themselves. Contact the admins of important peers using their ServerMetadatacontact(02 §7.3.5). - Assess what the key could forge between
rvtand revocation:
| Object | Possible abuse | Remedy |
|---|---|---|
| HomeAssertion | Sessions at remote servers as any local user. Secure contexts also need a DeviceProof by a DSK, which the key doesn't give. | Remote sessions last at most 1 h and can't be renewed with the revoked key (06). Tell peers' admins if abuse is suspected. |
| IdentityState | A fake reset of a local secure account: silently accepted in channels, W2 for DM contacts, W4a on the victim's devices (as for D-071). A forged state with a very high ver would make verifiers reject the real ones as rollbacks. |
Verifiers accept nothing new signed by the revoked key, discard every state signed by it that they didn't accept before rvt − 60 s by their own clock, and refetch (02 §11.7, 07 §7.5), so re-signing (step 5) is enough. |
| S2S token | Forged identity.changed, device.revoked, dm.request, notify.event, report.forwarded. |
Mostly denial of service or spam. Peers stop accepting at revocation. |
| RelayTicket | A session replacing a participant's session on this server's relays (15 §5.2), receiving and sending as that participant: in insecure calls, hearing and seeing what that participant may, and speaking or sharing with that participant's rights. Secure calls stay protected by SFrame and MediaAttestation. | At step 4 relays reject new tickets and close the sessions opened with the key (§6.7 rule 4). Review sv_relay_session_down_total{reason="replaced"} and {reason="key_revoked"} for the window. |
| KeyRotation | Backdated rotations to attacker keys. | Skipped by every verifier once the key is revoked (02 §12.3). |
- Wider incident. If the host was compromised, also rotate the
mls-external-senderkey (§8.5), relay credentials, the VAPID key, OIDC client secrets (05) and database credentials, and follow the backup-restore guidance of §11.6 if data may have been altered. - Record the incident in the audit log as
server_key_incidentwith actor kindoperator(10 §11.3).
8.5 R4: the mls-external-sender key is compromised
- List it as
revokedwithrvt; activate a new key with a KeyRotation signed by the activesignkey; purge or revalidate any CDN or shared cache in front of/meta, then senddiscovery.metadata_changedwithurgent: true(02 §16.1). - Keep the compromised private key usable for one purpose only: signing the replacement GroupContextExtensions proposals, and Remove proposals in groups that haven't yet committed the rotation (13 §6.2 items 5 and 8). The server issues the replacement proposal in every current group at once. Clients accept it although it is signed by the revoked key (13 §6.2 item 2's exception), so groups move to the new key at their next commit.
- Destroy the compromised key once every current group has committed the rotation. A group that still hasn't after 30 days is retired (13 §15.6, reason
operator), so the key can be destroyed; its members bootstrap or join the next generation under the new key without being asked. - If the compromised key can't sign at all (it was destroyed, or the HSM refuses it), follow §8.6 case B instead.
- Impact is small: the key lets someone produce proposals that look server-originated, but proposals reach groups only through the hosting server's Delivery Service, and clients check them against 13's policy. Treat it as a sign that the host may be compromised and consider §8.4.
8.6 R5: a key is lost without compromise
Lost HSM, deleted key file.
Case A: the sign key. Follow §8.4 steps 1 to 6 with rvt set to the loss time; skip step 7. With a standby, no peer notices anything beyond a metadata change.
Case B: the mls-external-sender key. Nothing can sign the replacement proposal that groups need (13 §6.2 item 5), and a group whose extension names a key that is no longer listed, with no replacement proposal pending, is a positive rejection for clients (13 §6.2 item 2). So: publish a new key and make it active with a KeyRotation signed by the active sign key; retire the current generation of every secure group that names the lost key (13 §4.2 case G-c, §6.2 item 8, reason operator); then list the lost key as retired, or as revoked if it may have been exposed (§8.5), and remove it once its exp has passed. The next generation names the new key. Members bootstrap or join it without being asked; earlier history stays readable from each member's key archive (§11.7 item 4).
8.7 Other secrets
| Secret | Rotation | If compromised |
|---|---|---|
| Relay credentials (§6.2.2) | Add the new credential at call control, configure the relay, let it reconnect, remove the old one. Call control accepts two per relay at a time. | Remove it at once; the link closes with 4001. Review relay-link logs for unknown relayIds. |
| TLS certificates | ACME, renewed at two thirds of their lifetime; alert 14 days before expiry. | Revoke through the CA; reissue. same-site evidence depends on a valid certificate for the base-URL host (02 §9). |
VAPID key (webPushKey, 02 §7.3.1) |
Avoid rotating: Web Push subscriptions are bound to it, and devices must re-subscribe (19). | An attacker can send wake-ups to subscribed browsers, which carry only opaque IDs (D-051). Rotate; clients re-register as 19 specifies. |
| OIDC client secrets (05) | Per provider policy. | Rotate at the provider and in the server configuration. |
| Push gateway credentials (APNs keys, FCM service accounts) | The gateway operator's matter (19). | The gateway operator rotates them. |
8.8 Responding to a peer suspension
When a peer's base URL or key set changes without continuity, 02 §10 suspends federation with it and sends discovery.peer_suspended to the server's admins.
- Read the PeerPin (
GET {base}/v1/resolve/pins/{domain}):reason, the pinned and observed base URLs, keys and evidence. - If the reason is
base_url_changedorkeys_changedand the peer announced a move or a key emergency (check its website or contact it through its ServerMetadatacontact), accept exactly what was observed withPOST …/pins/{domain}/accept(02 §10.5). - If you can't confirm, wait: many suspensions resolve by themselves when the peer adds strong evidence (02 §10.3).
key_unrevokedandsecure_downgradecan't be accepted (02 §10.5): wait, or forget the pin only after confirming with the peer's operator. Acceptcanonical_changed,chain_forkorchain_rollbackonly after talking to the peer's operator: a canonical domain can't change in v1 (D-032), socanonical_changedis acceptable only for an alias that moved, and a fork or rollback suggests a key compromise or a restored server.
UX: users see only that the other server is temporarily unreachable (02 §10.4, 06 §13.4); admins see the plain-language alert of 02 §10.5.
9. Outage behaviour
9.1 Outage matrix
This matrix summarises what the owning documents specify (06 §13, 15 §6.7, §6.9, §10, 19) and adds the deployment view. "Users see" names intent; 20 owns the copy. No outage produces a security warning (00 §4.12.5).
| Down or failing | What keeps working | What stops | What users see | Recovery |
|---|---|---|---|---|
| Home server (a.com) | Chat, calls and rejoins in contexts on other servers where the user already has a session; sessions there are extended up to 24 h after the last verification (06 §6.6, D-062). | Sign-in; new remote sessions; new secure joins and new devices; DM requests, notifications and pushes to a.com's users (queued at senders for 24 h, 06 §9.7); revocation fan-out from a.com; KeyPackage claims for a.com's users. | A quiet status line: "Your server isn't responding. You can keep chatting where you're already connected." | Automatic when a.com returns: queued events arrive, extended sessions renew. Events older than 24 h are lost. |
| Hosting server (b.com) | Everything on other servers. | Every context and call hosted at b.com. | Waiting messages marked "Waiting for b.com…"; a status line in its contexts; calls show reconnecting, then "can't connect right now" after the rejoin schedule (15 §10.5). | Clients retry sends with the same client-generated IDs (no duplicates, 11) and rejoin calls; S2S events to b.com are queued for 24 h. |
| One relay node of a pool | Calls on other relay nodes; text. | Media through that node. | Usually a gap of about 1–4 s and nothing else: call control fails calls over before clients notice, as a planned migration that keeps mic and push-to-talk state (§6.9.3). Someone holding push-to-talk during the gap sees the "not being heard" indicator until the new relay's first tick. A client that notices first shows reconnecting, and voice-activation users come back muted (D-012). | Automatic failover; seats keep their pids. |
| All relays of a server (or the single relay of Profile S) | Text, DMs, everything except calls. | Calls. Joins fail with call.relay_unavailable (503, wait). |
Reconnecting, then "Can't connect to the call right now." | Clients keep retrying while the call screen is open (15 §10.5). Call control moves the seats to reconnecting at the failover (§6.9.3 step 1); seats whose devices don't rejoin are removed 30 s later and calls end (empty or completed). |
| SFU | Voice (never on the SFU, 15 §7.1); video falls back to video-dc/1 if call control switches videoRoute to dc. |
sfu-rtp/1 video. |
Video pauses for a few seconds; voice continues. | Call control SHOULD switch videoRoute to dc when the adapter reports the SFU unavailable (sfu.closed reason sfu_failed), and back later. |
| Push gateway (for one app build; the official gateway serves every installation of the official apps, on every server, D-093) | Everything for apps in the foreground and for web and desktop clients (Web Push needs no gateway). Notification records are still stored. | Wake-ups for that app build in the background: notifications and DM call rings. | Late or missing phone notifications; a DM call rings out after 45 s (15 §13) and the caller sees it wasn't answered. Opening the app shows everything. | Retries per 19. Nothing is lost: the device fetches records when it next runs. |
| OIDC provider (one of several) | Existing sessions (the home server keeps its own tokens and discards the provider's, 05); sign-in with other linked providers. | Sign-in with that provider; operations that need fresh authentication (05 P-05-8), such as reset or deletion, for users with no other linked provider. | "Google sign-in isn't working right now" on the sign-in screen, with other providers offered. | Automatic. Encourage users to link a backup provider (05). |
| DNS (the operator's zone, or resolvers) | Cached resolutions: positive caches up to 24 h, stale use up to 7 days while unreachable (02 §13). | First contact with servers not in cache; new users finding the server. | Mostly nothing for existing users; new contacts show "server not found". | Restore DNS. Keep discovery TTLs at 3,600 s (02 §15.1) so short outages don't matter. |
| Database primary | Reads from replicas if the implementation allows; nothing durable. | Every write: messages, joins, commits, revocations. | Messages wait and retry; calls already in progress continue (call control keeps state in memory, §4.2) but new joins fail. | Fail over to the synchronous replica (§11.6.1); RPO 0 with synchronous replication. |
| Call-control node owning some calls | Media continues for 3 s on the last snapshot (15 §4.5). | Snapshots for its calls. | If a new owner takes over within about 2 s, nothing; otherwise a short silence, then the call resumes, or ends with server_restart if its state was lost (clients rejoin). |
Fenced ownership handover (§10.4). |
| Object storage | Text and calls. | Attachment upload and download, avatars and icons. | "This file can't be loaded right now." | Restore; clients retry. |
| Link between two servers | Each server works for clients that can reach it; sessions are created with cached keys (06 §13.3). | S2S events between them (queued). | Usually nothing. | Automatic. |
| Peer key-set suspended (02 §10) | Everything else; inbound S2S from the peer whose token verifies under a pinned key, including its revocations; remote sessions created or renewed with assertions signed by a pinned key (06 §13.4). | Outbound S2S to the peer (held in the queue); assertions for the peer; anything signed by an unpinned key; session extensions (06 §13.4). | "b.com is temporarily unreachable." | The admin resolves it (§8.8). |
9.2 Monitoring and alerting
Operators SHOULD alert on at least these conditions:
| Condition | Threshold (suggested) | Why |
|---|---|---|
/meta unreachable from outside |
2 failed probes 1 minute apart | Every peer and client depends on it (02 §7.1). |
| Self-check failure (02 §15.3) | Any domain not resolving to the server's base URL | Users can't find the server. |
Active key expiry (sv_keys_active_expiry_seconds) |
Warn below 30 days; page below 8 days and 1 hour | 02 §11.4 requires exp later than now + 7 days + 25 h; below 8 days and 1 hour a routine rotation (§8.2) can no longer finish in time. §6.12 and §8.1 use this rule. |
| TLS certificate expiry | < 14 days | |
| Revocation fan-out 95th percentile | > 10 s over 15 minutes | 06 §11.3 target. |
Federation queue oldest event, high lane |
> 5 minutes | Revocations stuck. |
| Peer suspensions | Any new one | 02 §10.3; an admin decision is needed. |
sv_callctl_snapshot_interval_seconds outside 0.9–1.1 s |
p99 over 5 minutes | Lease timing (15 §4.3). |
sv_callctl_revocation_push_seconds |
p99 > 0.5 s | A MUST of 15 §4.3. |
sv_relay_calls_stale |
> 0 for 10 s | Control or link failing. |
sv_relay_dropped_total{reason="queue_full"|"too_late"} rate |
> 2 % of forwarded | Relay overloaded or links congested. |
| MLS 425 answers (13) | Sustained | Commit storms in one group. |
| Reports waiting with no admin able to see them (10) | Any | 10 asks servers to alert the operator. |
Rate of call_failure reports received (15 §14.3) |
A sustained rise over the previous 7 days' level | Clients send failure reports by default (D-089), so a rise is often the first sign of a relay or network problem that users can't describe. |
| Disk, database replication lag, backup age | Per the operator's policy | §11.6. |
10. Version skew and upgrades
10.1 Protocol versions across a federation
Servers and clients of different minor versions interoperate by design (03 §12): minor versions are additive, receivers ignore unknown members, event types and features, and each side uses only the intersection of advertised features. Operators can upgrade on their own schedule. Two rules follow for implementers:
- Never depend on behaviour of a minor version higher than the one a peer or client lists (03 §12.1 rule 3).
- A new major version (
/v2) is served alongside/v1, including S2S endpoints, for at least 12 months (03 §12.5). Servers federate on the highest major version both list.
10.2 Rolling upgrades of one deployment
A multi-node deployment runs old and new software side by side during an upgrade. ServerMetadata states what the server serves (02, 03 §12), so it should never claim more than its oldest node can do. To keep clients and peers from seeing a capability that some node can't serve:
- Advertise last. A server SHOULD NOT add a version, feature or raised limit to ServerMetadata until every node that may serve a request relying on it runs software that supports it.
- Withdraw first. Before removing support for a feature or lowering a limit, the server SHOULD first update ServerMetadata, then wait at least the metadata's
max-age(at most 86,400 s, 02 §7.1) plus 60 s before any node stops supporting it. A limit is never lowered below its floor (§12, 00 §7.12). - Wire compatibility inside the deployment. Messages between nodes (bus events, sequencer RPCs, the relay-control link) change additively, or are versioned so old and new nodes can both handle them.
- Database schema changes follow expand, migrate, contract: add new structures, deploy code that writes both, migrate data, deploy code that reads only the new form, then remove the old structures. No step may rewrite any counter of §4.10 (
seq,ver, epochs) downwards.
Rationale: a client that learns a feature from /meta and then hits an old node would get core.unsupported_feature, which users experience as a random failure.
10.3 Upgrading relays and SFU nodes
- Upgrade relay nodes one at a time by draining them (§6.9.1): no call drops, nobody hears a gap.
- A relay announces its binding version in
relayctl.hello; call control answers with the highest minor of the shared major (§6.4.1). Call control SHOULD support the previous minor version of the binding for at least 12 months. - SFU nodes: call control switches calls on the node to
videoRoute: dc(15 §7.2), or moves their SFU sessions to another node by closing them withsfu.closedand letting clients recreate them, then upgrades the node. Voice is never on the SFU, so nobody's voice is interrupted.
10.4 Restarting call control, sequencers and gateways
- Owned state (a context's sequencer, a call's call control) moves between nodes with a fencing token: a number that increases with every change of owner and is checked by the database on every write, so a paused old owner can't write after the new one has started.
- Planned handover of calls. The old owner stops producing snapshots only after the new owner has started. If the handover leaves a call without snapshots for more than 2 s, participants hear silence from about 3 s (15 §4.5) until snapshots resume; if it takes longer than about 5 s, clients detect relay failure and rejoin. The new owner continues snapshot
seqabove the old owner's (15 §4.3 rule 3). Call ownership and link holding (§6.2.1 rule 4) are independent: a change of call owner moves no control link, because the new owner reaches each relay through its link holder. A change of link holder (for example when the holder's node is upgraded) happens when the relay links again to another node: the old link closes with 4009 and the new holder resynchronises (§6.4.1), and forwarding continues meanwhile because the relay keeps its calls (§6.8). - Gateways close sockets with code 1012 and spread
retryAfterMsover 0–30 s (03 §5.10), except that sockets of sessions participating in a call get at most 2 s. Drain gateways one at a time. - Crash recovery. A call whose state can't be recovered ends with
server_restart(15 §2.4); a sequencer never loses committed events because events are committed before they are delivered.
10.5 Clients
minClient(03 §12.4) makes older clients show "update required" for this server only. Raise it only to stop behaviour that is insecure or that breaks other users.- Web clients are served by the operator or a third party (D-065). Deploy new web-client builds with the hardening profile of 20 (CSP, SRI) and publish their build hashes; a deployment of the web client is a security-relevant change for every secure user of that origin (00 §10 item 4).
10.6 Rolling back server software
Rolling back software is allowed when the older version can read the current schema, after first withdrawing from ServerMetadata anything the newer version advertised (§10.2 rule 2). Rolling back data is a restore and follows §11.6.4. Never roll back a database to undo an operation: in particular, never to undo a channel or server upgrade (D-018, D-073).
10.7 Interoperability notes
- Rate-limit headers (pinned here for 03 OQ-03-3): servers that emit the IETF headers use the structured-field syntax of
draft-ietf-httpapi-ratelimit-headers-09:RateLimit-Policywith a quota policy item carryingq(quota units) andw(window in seconds), andRateLimitwith a matching item carryingr(remaining units) andt(seconds until the quota resets), for exampleRateLimit-Policy: "default";q=100;w=60andRateLimit: "default";r=12;t=40. The headers are advisory: clients MUST tolerate their absence, other draft revisions and a later RFC form, and rely only onRetry-AfterandretryAfterMs, which are the normative signals (03 §15). If the draft has been published as an RFC or revised again by the time this document is published, the lead updates the pin. - CPace: use exactly the draft revision pinned by 04; a mismatch makes pairing fail for every user.
- SFU products: re-check §7's mappings at every SFU upgrade.
11. Admin operations
11.1 Setting up a server
- Choose the canonical domain with care: it can never change (D-032, 02 §8.3). Prefer a domain the organisation will keep, such as
example.org, over a host name such aschat.example.org. Host names can be added later as aliases. - Choose the base URL and, if it is on another host, publish
_sloppyv.<domain> TXT "v=sv1 url=<base>"with same-site delegation if possible (02 §15.1), and the.well-knowndocument if not. - TLS with ACME for the base-URL host, the relay host and any
.well-knownhost. - Keys: one active
signkey, one standbysignkey (next), one activemls-external-senderkey, all in the key service (§8.1). - Login providers (05): register the server as an OIDC client with each provider, using the redirect URI that 05 specifies; set the registration policy (
open,inviteorclosed, 02 §7.3.2). - Secure or not. Decide whether the server starts secure (09 §3.1). Starting secure is simpler than upgrading later, but every account homed there must turn on encryption at sign-up (SM-3). The setting defaults to insecure (
secure: false, SM-1); an implementation MUST NOT default it to secure. - First admins (normative; 10 §4.2 item 1 delegates this to 21). The operator configuration names each first admin as a local part bound to one sign-in identity: either a login provider identity (an external identity as 05 §4.4 keys it: provider ID, issuer and subject), or a one-time setup token that the server generates, shows only to the operator, and that expires after 24 h (presented at sign-up in
setupToken, 05 §8.4). The server MUST treat each configured local part as a server-local class A reservation (01 §5.4) and MUST let it be taken at sign-up, and grant theadminrole, only to that provider identity or to the holder of that token. It MUST NOT grant the role because of the local part alone. If the configured account already exists, the role is granted at its next sign-in with the bound identity. The grant is recorded in the audit log as an action with actor kindoperator(10). Rationale: the first admin gets every power, including the irreversible server upgrade (D-073), server bans and federation blocks; without the binding, whoever signs up first under the configured name would get them. - Calls: at least one relay with a public UDP port (§5.2) and its credential. Every call's media, in channels and DMs alike, goes through it or an SFU (D-094). Clients send call-failure reports to the server involved by default (D-089, 15 §14.2), so decide which admins read them: only the server's own administrators may see them, for at most 30 days (15 §14.5). Say in the server's privacy information that it receives them.
- Push: keep the default
gatewayPolicyany(D-093) unless you must control where wake-ups go; withlisted, include the official gateway's base URL (published with the official apps) if users of the official apps should get notifications. Generate a VAPID key for Web Push (02 §7.3.1, 19). - Federation policy:
openby default;allowlistfor private servers (06 §12). - Backups and monitoring (§11.6, §9.2) before the first user signs up.
- Publish contact information in ServerMetadata
contact(02 §7.3.5), so other operators can reach you during incidents (§8.4 step 6, §8.8). - Verify from outside: resolve the domain like a peer, fetch
/meta, sign up a test account, make a test call through the relay, and send a DM to an account on another server.
11.2 Operator actions outside the protocol
Some actions need the operator, because no protocol role is allowed to do them. Implementations provide their own tools for them; each MUST be recorded in the audit log with actor kind operator where 10 says so.
| Action | Specified in |
|---|---|
| Naming the first admins, bound to a provider identity or a one-time setup token | 10 §4.2, §11.1 item 7 |
Removing the admin role from someone else |
10 §4.2 |
| Suspending and restoring a local account | 05 §11.2 (P-05-10) |
Assigning reserved (class A) local parts; releasing a quarantined local part early (the next registration is a new account with a new inc; nothing of the deleted account is restored, D-086, D-091) |
01 §5.4, §5.7; 05 §11.1, §16.1 |
| Handling reports that no admin may see | 10 |
| Retiring a broken MLS group | 13 §15.6, §11.7 below |
| Accepting or deleting peer pins | 02 §10.5 (also available to admins through the API) |
An operator MUST NOT use direct storage access to do anything the protocol forbids, in particular to make a secure channel or server insecure, clear securedAt or upgradeSeq, remove or rewrite entries of the security journal (§11.6.1), or serve plaintext in a secure context (09 §12). Clients detect such a change as W9 (D-056).
11.3 Enabling a secure server (irreversible)
Making an existing server secure (09 §11) encrypts every channel and requires every account homed there to turn on encryption. It can't be undone (D-073).
Before:
- Make sure every admin who will remain an admin has a secure account, an enrolled device, and a saved recovery key. The upgrade itself needs a local account holding the
adminrole (manage_communityisn't enough), with encryption turned on, confirming from an enrolled device (09 §11.1). - Run the dry run (
PATCH /v1/communitywithdryRun: true, 09 §11.2) and read the plan: how many local and remote accounts can't follow, how many insecure DMs hosted here will close, how many webhooks stop working, how many calls will restart. - Tell the community in advance, in plain words: what changes, what each person must do ("turn on encryption when the app asks"), and that the change is permanent.
- Replace webhooks and insecure bots with secure bots where needed (D-061): webhooks stop working in secure contexts.
- Take a fresh backup and record the time, and check that the security journal (§11.6.1) is being written: any later restore must re-apply the upgrade (§11.6.4 step 2).
- Pick a quiet time: calls in channels restart (15 §12.2) and insecure DMs close.
During: an admin confirms through the W5 dialog of their client (09 §11.3, 20), which sends the confirmation with confirmDomain and planVersion. The server applies T1 to T7 atomically (09 §11.4); allow up to 120 s.
After:
- Watch the number of local accounts in
upgrade_required(05) fall. Each sees one blocking screen, "Turn on encryption to continue", and nothing else. - Remote insecure members see G1; they keep their membership and can come back after turning on encryption.
- Insecure DMs that were hosted here show K5 and continue at the host chosen by 12's rule.
- No server-to-server message announces the change; peers and clients learn it from ServerMetadata and events (09 §11.5).
A server can also be created secure from its configuration (09 §3.1); then there is nothing to migrate.
11.4 Alias domains
| Task | Steps |
|---|---|
| Add an alias | 1. Add the domain to domains (02 §8.2). 2. Then publish its discovery record (same-site if possible). 3. Run the self-check. Addresses on the alias now work as input and are shown in canonical form (D-032). |
| Remove an alias | 0. Stop generating links on the alias, and keep it registered, delegated and listed in domains for at least 365 days after the last such link (01 §7.9). 1. Remove the discovery record. 2. Wait at least 24 h (02 §8.2, §13). 3. Remove the domain from domains. Keep the domain registration, without any delegation, so nobody else can take it over (01 §7.9). Old links using the alias stop working; stored data is unaffected. |
| Move an alias to another server | The alias's owner points its record at the other server, which lists it. Peers accept the move only with strong evidence (02 §8.3); with weak evidence they suspend that domain until their admins accept it. Prefer same-site delegation or a .well-known document for the move. |
| Rename the server | Not possible in v1: the canonical domain is immutable (D-032). Add the new name as an alias, or run a new server (accounts and secure identities don't carry over). |
TLS certificates are needed for an alias only where it is used as a host: in a base URL, a relay URL, a .well-known fallback, or as the host of the links.join share-link template (01 §11.3).
11.5 Federation blocks
06 §12 specifies blocks and the admin API (/v1/federation/blocks…, /v1/federation/policy). Operational guidance:
- Block or ban? Use a community ban (10) to keep a server's accounts out of the community while still exchanging DMs and revocations with it. Use a federation block for an abusive server: it stops everything, including DMs (06 §12.5).
- Scope. Blocks cover every alias of the peer (00 HP-7). Use
includeSubdomainsfor spam operations that create many subdomains. - Effect takes place within 60 s: sessions of the peer's users end, their call leases are revoked, their MLS leaves are removed (recorded as
federation_blocked, not as moderation), and queued events to the peer are dropped (06 §12.5). The one exception: for 30 days after the block, the server keeps sendingidentity.changed,device.revokedandaccount.deletedabout its accounts that had sessions at the peer, so that the peer can end those sessions and remove their leaves (06 §12.5). - Unblocking restores federation for new requests only; nothing dropped is replayed.
- Allowlist mode suits private or corporate servers that should federate only with known partners.
PUT {base}/v1/federation/blocks/spam.example
{ "includeSubdomains": true, "note": "Bulk message requests from many subdomains, 2026-12-04" }UX: users of either server see only that the servers don't connect (06 §15). There is no security warning.
11.6 Backups and restore
11.6.1 What to protect
| Data | Back up? | How |
|---|---|---|
| Database (accounts, memberships, timelines, SealedMessages, MLS DS state, HistoryShares and VisibilityGrants, KeyPackages, KeyBackups, AccountVaults, outbox queues, audit log, pins, blocks) | Yes | Continuous archiving with point-in-time recovery (PostgreSQL WAL archiving; Litestream for SQLite), plus a synchronous replica for failover. A restore rolls back everything here, the audit log included. |
| Security journal (below) | Separately, like the keys | Append-only and replicated, outside the database; never rolled back with it. |
| Blob store | Yes | Object-store replication or versioned snapshots, with lifecycle rules that respect deletion deadlines (§11.6.3). |
| Configuration (providers, limits, policy, relay credentials' hashes) | Yes | Version control, without secrets. |
| Server private keys | Separately | HSM backup or sealed export held apart from database backups, by fewer people. Never in a database dump. |
| Relay and SFU state, WebSocket replay buffers, caches | No | Rebuilt on start. |
Security journal (normative). A restore that loses data must not undo a security transition: SM-7 and D-073 (never back to insecure), D-017 and 07 §7.3 (a revocation or reset stays in force, and ver and igen never repeat), 13 §4.2 (generations never reused) and 02 §12.2 (KeyRotation numbers never reused). The database's own audit log can't guarantee this, because it is restored to the same point as everything else. A server MUST therefore append each of the following to a security journal kept outside the main database, with at least the durability and separation of the server keys (for example a write-once object store, an append-only file on the key-service host, or the key service itself), and MUST make each append durable before it acknowledges the change or sends any event about it:
- server and channel security upgrades, with
securedAtandupgradeSeq(09); - every IdentityState it signs whose content changed (07 §7.3), as the signed JWS, together with the DeviceCertificates it lists: this covers device registrations and revocations, DeviceRevocation uploads, upgrades, resets and downgrades, with their
verandigen; - account deletions and changes of account state (05);
- the MLS group-generation high-water mark of every context (13 §4.2, which already requires storage that a restore doesn't roll back);
- the server key state of §8.1 item 3, unless the key service already holds it.
It SHOULD also journal bans (10), federation blocks and policy changes (06 §12), and grants and removals of the admin role (10 §4.2), so that a restore doesn't quietly let back in people or servers that were kept out. Entries are small. The journal is kept at least as long as the oldest backup that might still be restored. A single-binary deployment (Profile S) can keep it as an append-only file next to its keys and copy it off the host with them.
Proposed decision PD-21-4: every server keeps a security journal outside its database, written synchronously with each security transition, and replays it after a lossy restore (§11.6.4 step 2). Rationale: without it, a restore silently revives revoked devices and undoes upgrades and resets, which breaks D-017, D-073 and 07 §7.3; the audit log can't help, because it is restored with the database.
Targets (suggested): RPO 0 for failover to the synchronous replica; RPO ≤ 5 minutes and RTO ≤ 4 h for a restore from archives. Test a restore at least every quarter. Encrypt backups at rest.
Failover to a synchronous replica is not a restore: no committed data is lost, so §11.6.4 doesn't apply.
11.6.2 What backups mean for users
In insecure contexts backups contain readable content. In secure contexts they contain only ciphertext, metadata, MLS public state, and KeyBackups and AccountVaults that the server can't open (D-052, D-054). 20's W5 copy and 09 §18 already avoid promising that deleted pre-upgrade plaintext disappears from backups.
11.6.3 Retention constraints
| Data | Deleted from live storage | Gone from backups | Source |
|---|---|---|---|
| Deleted or expired messages, SealedMessages, reactions, edits | At once (content), tombstone after ≥ 30 days | Within the backup rotation, which SHOULD be ≤ 30 days | 11 |
| Attachment blobs | Within 24 h | Within the rotation (≤ 30 days) | 11 |
| Superseded KeyBackup and AccountVault | At once | SHOULD within 30 days | 08, 07 |
| Diagnostic reports | After ≤ 30 days | Within the rotation | 15 §14.5 |
| Deleted accounts | As 05 specifies | Within the rotation | 05 |
| Audit log | After 90–365 days by policy | — | 10 |
| Security journal | Entries kept while any backup older than them may still be restored; they hold security state and public objects, never content | — | §11.6.1 |
A backup rotation longer than 30 days breaks these SHOULDs; operators with legal retention duties must document the conflict.
11.6.4 Restoring with data loss (normative)
A restore from a point in time P before the failure loses everything committed after P. Several counters of §4.10 would then repeat values that clients and peers have already seen, which they treat as rollback or equivocation, and security transitions made after P would be undone. Before serving any request after such a restore, the server MUST take these steps, in this order. Each names the rule it keeps.
- Keep its current keys and key state. Server keys aren't part of the database restore. The key set with each key's
status,nbf,expandrvt, the fullkeyChainand the highest KeyRotationnare taken from the key service or the security journal (§8.1 item 3), never from the restored database. Keys revoked afterPstay revoked (02 §10.2: a revoked key never returns), and no KeyRotation number is issued twice (02 §12.2). A server that can't establish the highestnit has issued MUST NOT issue a KeyRotation until it has, for example from its own/metaas a peer cached it, or from the operator's records. - Replay the security journal (§11.6.1) for everything after
P, before it signs any IdentityState or sends any event: re-apply channel and server upgrades with theirsecuredAtandupgradeSeq; restore each account's identity content (security state,inc,igen, IdentityCertificate, active and revoked devices) from its newest journaled IdentityState; re-apply account deletions and account-state changes; and, where journaled, bans, federation blocks andadminchanges. If the server or a channel was secure at any time afterP, it is secure after the restore (SM-7, D-073); otherwise clients show W9 (D-056). A device revoked afterPstays revoked (D-017). A restore never generates a newincfor an existing account (05 §11.1, D-086): every account the restored database or the journal holds keeps itsinc, and a later registration of a local part whose account was lost is a new account. - Retire MLS generations. Retire the current generation of every secure group whose Delivery Service state may have changed after
P, or of every secure group if that can't be determined (13 §15.6 rule 1, reasonstate_lost). Allocate the next generation above the high-water mark (13 §4.2): the journaled mark + 1, or the restored generation + 1,000 if the mark isn't available. Clients bootstrap or join the next generation without prompting. - Continue IdentityState versions. Increase the stored
verof every account by at least 2^32 (07 §7.3), then sign new IdentityStates with the identity content of step 2. Only then re-sendidentity.changed(06 §11) to the audiences of every account whose identity content differs from what the restored database held. - Reset streams. Send
session.resync_requiredwith reasonserver_reset(03 §7.5) for every stream clients resume, so clients discard state that the server no longer has. Clients holding positions beyond the server's head get reasonaheadanyway (03 §7.4). - Close replay windows. The replay caches of
jtis can't be trusted after a restore, so single use (06 §8.6, 15 §5.2 step 6) would break. For 360 s (the longest token lifetime, 300 s, plus 60 s of skew) after serving resumes, the server refuses HomeAssertions, DeviceProofs, S2S tokens and RelayTickets whoseiatis earlier than the moment serving resumed, with the existing replay errors:federation.assertion_replayed,federation.s2s_unauthenticatedwith reasonreplayed, andrelay.ticket_replayed. Honest clients already retry those with fresh tokens (06 §6.10), and a sending server signs a fresh S2S token for every attempt, so no new error code is needed. - Purge regular KeyPackages. Delete every stored regular KeyPackage that hasn't been claimed: one restored from before
Pmay have been claimed afterP, and handing it out again would break 13's single-use claim (13 §9). Keep each device's last-resort KeyPackage, which 13 §9.3 lets the server hand out more than once, so that offline devices can still be added by Welcome after step 3. Sendmls.keypackages_low(13 §9.3) to every device as it connects, so that it refills. - End calls. Every call in progress ends with
server_restart(15 §2.4), and relays that still hold one are told withrelayctl.call_closereasonlostorunknown(§6.4.7), so clients rejoin rather than leave. - Without a journal. A server that has no security journal, or whose journal misses a change, can't do step 2 for it. Its operator MUST re-apply the upgrades, revocations, resets and deletions made after
Pthat can be found in records kept outside the restored database: the operator's own notes, exported logs, or what peers received (device.revoked,identity.changed). The restored audit log can't help, because it ends atP. Whatever can't be found stays lost: an undone channel upgrade shows W9 to members who saw it (D-056), a revoked device is listed again until the user revokes it again, and a lost reset or upgrade leaves verifiers rejecting the account's states until the user resets again (07 §7.3). Clients show no extra prompt for any of this (00 §4.12); an operator who wants to tell users does so outside the client's security surface, for example with an announcement in the community or by e-mail. - Discard pairing sessions, idempotency keys, rate-limit counters and pending S2S deliveries older than 24 h.
UX: users see recent messages missing. In secure contexts each device keeps the history keys it holds and takes any it lacks from the key archive (08, 14 §10.4) without any marker; K4 appears only on a user's own new device, or while messages a member shares again load (00 §4.12.3). HistoryShares made after P are lost with their VisibilityGrants: their recipients stop being served those earlier messages until a member shares them again (14 §7). With a complete security journal, security changes made after P survive and nobody needs to act. Without one (step 9), an account whose upgrade, reset or downgrade after P was lost may be unable to open secure contexts until the user resets, and that reset shows W2 to DM contacts (07 §7.3). KeyBackups and vault records written after P are also lost, and no document yet makes clients re-upload them, so a recovery key created after P may not work for a restore until a device uploads the backup again (OQ-21-10). The way to avoid all of this is failover to a synchronous replica (RPO 0, §11.6.1), which isn't a restore.
Proposed decision PD-21-3: a restore with data loss follows §11.6.4 before serving any request. Rationale: it is the only way to keep the monotonic counters, single-use rules and one-way security transitions of 02, 03, 06, 07, 09, 13 and 15 true after a restore; without it, peers see IdentityState rollbacks, clients see sequence and epoch forks, KeyPackages and tokens could be reused, and revoked devices and undone upgrades come back.
11.7 Retiring a broken MLS group
13 §15.6 lets an operator retire a group that can't be repaired (case G-c). Signs that this is needed: repeated mls.verification_failed diagnostics for one group from several devices, members unable to commit because of positive rejections, or an ekid fork that resync doesn't repair (13 §15).
- Confirm the group is broken for more than one device and that ordinary resync (13 §15.5) has been tried.
- Retire it with the implementation's admin tool (reason
operator). The server emitsmls.group_retiredwithnextGeneration. - The first enrolled member device to open the context bootstraps the next generation; others join by external commit (DMs: by Welcome, 13 §15.6 rule 3). Nobody is prompted.
- Earlier history remains readable from each member's devices and key archive (08). A new generation changes nothing about who may read what: newcomers see nothing from before their join in any generation (14 §10.6, D-007 as revised).
11.8 Changing limits
- Never advertise a limit below its floor (§12, 02 §7.3.3).
- Raising
maxSecureLeavesrequiresmaxMlsUploadBytes≥ 2,048 ×maxSecureLeaves+ 65,536 (13 §17.1), and reverse-proxy body limits to match. - Raising
maxAttachmentBytesrequires proxy and object-store limits of at leastsvf1Size(maxAttachmentBytes)for secure blobs (04, §4.7). - Lowering a limit applies to new requests only; existing objects stay. Follow §10.2 rule 2.
11.9 Moving and shutting down a server
Moving to a new base URL (new host or provider) follows 02 §15.6: a URL-bound KeyRotation at least 25 h before switching DNS, lower TTLs, keep the old base URL serving for at least 24 h. Every KeyRotation after the URL-bound one, of any purpose, names the new base URL (02 §15.6). Signed-in users stay signed in.
Shutting down a server ends its accounts, because accounts can't move to another server in v1 (D-032):
- Announce it well in advance, and tell users plainly that their DMs with people on other servers will end. Someone who creates an account elsewhere has a new address: their contacts see nothing automatically and start a new conversation with no warning, so users should tell their contacts their new address themselves.
- Stop new sign-ups (
registration: closed). - Delete the accounts through 05, which sends
account.deletedto every audience so peers end sessions and remove leaves (06 §11.4). - End calls, drain relays, stop.
- Remove the discovery records. Peers keep their pins until they delete them, which they MAY do after 400 days without verification (02 §10.1). Until then, if someone else runs a server for the same domain with new keys and only weak evidence, peers that pinned the old one suspend federation until their admins accept it. Pins only slow such a takeover: a new holder of the domain can publish same-site delegation with an ACME certificate, which is strong evidence that peers accept without suspending (02 §10.2). What protects former users' DM contacts is their identity pins: an account re-created at an old address has a new identity key, so its secure DM contacts see W2 (07). Channels give no such protection.
12. Limits (informative copy)
Every limit is advertised in ServerMetadata limits (02 §7.3.3) under its max<Thing><Unit> name (03 §16.1). The owning document is normative; this table is a convenience copy of 00 §7.12 and the limits registered since. A server MUST NOT advertise a value below the floor.
| Limit | Default | Floor | Owner |
|---|---|---|---|
maxRequestBytes |
1 MiB | 256 KiB | 03 |
maxEventBytes |
1 MiB | 256 KiB | 03 |
maxSubscriptions |
1,000 | 250 | 03 |
maxReplayEvents |
5,000 (replay window ≥ 24 h) | 1,000 | 03 |
maxDevices |
30 | 10 | 05 |
maxLinkedProviders |
10 | 2 | 05 |
maxAvatarBytes |
1 MiB | 256 KiB | 05 |
maxBotsPerAccount |
10 | 1 | 05 |
maxBotTokens |
10 | 2 | 05 |
maxFederationEventBytes |
128 KiB | 128 KiB | 06 |
maxEnrolledDevices |
50 (at most 64) | 10 | 07 |
maxBackupBytes |
64 KiB | 16 KiB | 08 |
maxVaultBytes |
256 MiB | 32 MiB | 08 |
maxVaultRecordBytes |
16 KiB | 4 KiB | 08 |
maxChannels |
500 | 100 | 09 |
maxCategories |
50 | 20 | 09 |
maxActiveInvites |
1,000 | 100 | 09 |
maxCommunityIconBytes |
1 MiB | 256 KiB | 09 |
maxCommunitiesPerAccount |
500 | 100 | 09 |
maxRoles |
100 | 25 | 10 |
maxRolesPerMember |
25 | 10 | 10 |
maxOverwritesPerChannel |
100 | 25 | 10 |
maxReportItems |
25 | 10 | 10 |
maxMessageBytes |
16 KiB | 8 KiB | 11 |
maxAttachmentBytes |
25 MiB | 8 MiB | 11 |
maxGroupDmParticipants |
25 | 10 | 12 |
maxDmRequestBytes |
64 KiB | 64 KiB | 12 |
maxSecureLeaves |
1,000 (at most 65,536) | 100 | 13 |
maxMlsUploadBytes |
8 MiB (≥ 2,048 × maxSecureLeaves + 65,536) |
3 MiB | 13 |
maxCallParticipants |
200 | 25 | 15 |
maxPushRegistrationsPerDevice |
4 | 4 | 19 |
Documents 16, 17, 18 and 20 register no ServerMetadata limits at the time of writing. If any document registers more, its own table is normative and this copy should be updated.
Timers of the relay-control interface (owned here, §6):
| Timer | Value | Section |
|---|---|---|
relayctl.hello after the WebSocket opens; relayctl.welcome after relayctl.hello |
≤ 10,000 ms each | 6.2.1 |
Control heartbeat (relayctl.ping) |
1,000 ms | 6.8 |
| Link declared lost (either side) | 3,000 ms without a message or pong | 6.8 |
| Failover grace after link loss | 1,000 ms | 6.8 |
| Relay reconnect schedule | 250 ms, 500 ms, 1 s, 2 s, then every 2 s, ±20 % | 6.8 |
| Relay keeps an issuer's sessions while the link is lost | 30 s | 6.8 |
| Snapshot ack after processing | ≤ 100 ms (acks combined within 20 ms) | 6.4.4 |
| Periodic snapshot batching window | ≤ 50 ms; immediate snapshots never batched | 6.6 |
| Snapshot written to the link after it was produced | ≤ 250 ms, else discarded; immediate snapshots ≤ 500 ms after the decision | 6.6 |
| Link that accepts no write | treated as lost after 3,000 ms | 6.6 |
| Key update to relays after a change | ≤ 1,000 ms | 6.4.2 |
relayctl.keys_ack before the relay is treated as failed |
2,000 ms | 6.4.2 |
relayctl.session_up after relay.welcome |
≤ 100 ms | 6.5.1 |
relayctl.load interval |
5,000 ms, and on state change | 6.5.3 |
relayctl.call_stats interval |
5,000 ms | 6.5.4 |
relayctl.session_close after the decision |
≤ 500 ms | 6.4.5 |
| Session close flush | ≤ 1,000 ms | 6.4.5 |
| Call drain deadline | 10,000 ms | 6.4.6 |
| Drain pacing | ≤ 20 calls/s per relay (SHOULD) | 6.9.1 |
| Failover pacing | ≥ 200 calls/s (SHOULD NOT be slower) | 6.9.3 |
Migration window before an unmoved seat becomes reconnecting (failover, revoked key) |
10,000 ms | 6.9.3 |
| Rebalancing of one call | at most once per 10 minutes (SHOULD) | 6.9.2 |
13. Security considerations
- The relay-control link is a high-value channel. Whoever can speak as call control to a relay can grant or revoke media rights in every call on that relay (by sending snapshots), close sessions, and change the keys used to accept tickets. Whoever can speak as a relay can mark seats connected or reconnecting. Hence: TLS and relay authentication are mandatory (§6.2.2, §2.4), the control URL is not public, credentials are per relay node and per issuer, stored hashed, and rotatable (§8.7). The link carries no content and no media keys, so even a fully compromised link can't decrypt a secure call (00 §5.2): SFrame keys come from MLS, which relays never see.
- Relays are inside the hosting server's trust domain (00 §5.2, 15 §17 item 1). In insecure calls a relay hears and sees everything it forwards. A relay run by a third party for several servers (§3.4, §6.11) is trusted by each of them to the same extent; operators should only share relays they control.
- Issuer isolation. A relay serving several servers keys calls by issuer and accepts a ticket only for its own issuer's calls, validated with that link's keys (§6.11). The issuer of each link comes from the relay's own configuration and is checked against
relayctl.welcome(§6.2.2), so isolation doesn't rest on what call control claims. Without this, one tenant's call control could open sessions in, or send snapshots to, another tenant's calls, or mint tickets that let it replace a participant in them. - Dead-man rules survive component failure. Relays stop forwarding a call 3 s after its last snapshot (15 §4.5), whatever happens to the link; the SFU adapter pauses a call 3 s after its last snapshot (§7.1 rule 3); the SFU itself stops within 3 s when its adapter dies (§7.1 rule 4); and receivers enforce coverage on their own audio clock (15 §4.6). Receiver checks stop a revoked sender from being played, but only the relay or SFU can stop a kicked or banned listener from receiving, which is why §7.1 rule 4 requires the SFU to stop with its adapter rather than relying on restarts or idle timeouts.
- Key custody decides the blast radius of a server compromise. A stolen
signkey lets an attacker impersonate the server's users to other servers, forge IdentityStates (a silent fake reset in channels, W2 in DMs, W4a for the victim, as with D-071) and hijack relay sessions on its relays until revocation (§8.4 step 7). HSM or KMS custody, a standby key that peers already pin, and same-site delegation (so peers accept the replacement without suspending) shorten recovery from days to minutes. - Backups contain metadata, insecure plaintext and ciphertext. They need the same protection as the live database. Secure content in backups stays encrypted under keys the server never held (D-052, D-054). Server private keys are kept out of database backups (§11.6.1), so a stolen backup can't sign anything.
- Restores can break security invariants if done naively: rolled-back IdentityState
vervalues look like equivocation; restored KeyPackages could be served twice; restored replay caches allow token replays; a pre-upgrade restore would downgrade channels; and revocations and resets made after the backup would be undone, bringing a stolen device back. The security journal (§11.6.1) and §11.6.4 close each of these; a server without a journal can close only the counter problems. - Calls don't expose clients to each other. Clients never send media or signalling to each other directly (D-094): every call path ends at the hosting server's relay or SFU. Other participants never learn a user's IP address from a call; only the hosting server and the operator of its relay or SFU see it (§5.4). The relay or SFU also enforces leases on every path (15 §4.5, §4.7).
- Metrics and logs can become a metadata leak. §5.4 and §6.12 keep identities out of metrics labels and limit relay logs. Diagnostics stay at the hosting server for at most 30 days (15 §14.5). Because clients send failure reports by default (D-089), every server receives them; a report holds counters only, never content, keys or IP addresses (15 §14.2), but the server sees the address the upload comes from, as for any request.
- Edge platforms (§3.3) add the platform operator to the hosting server's trust domain. In insecure contexts the platform can read content; in secure contexts it sees what the hosting server sees (00 §5.4). Signing keys SHOULD stay in a key service that the platform's general compute can't read.
- Operator powers are outside the protocol. An operator with storage access can do anything the hosting server can do (00 §5.2). The protocol limits what is invisible: downgrades show as W9 (D-056), identity changes in DMs show as W2, and a home server can't add a device under an existing identity key (D-033). §11.2 lists the legitimate operator actions and requires audit entries for them.
- Shutting down a server leaves pins at peers (§11.9), which slow a later takeover of the domain that has only weak evidence, but not one with same-site evidence. Former users' secure DM contacts are protected by their identity pins (W2), channel members are not.
- The official push gateway (D-093). Every installation of the official iOS and Android apps registers with the project's gateway, and servers deliver to it by default (
gatewayPolicyany). Its operator therefore learns, across every server that keeps the default, which home servers wake which official-app installations and when, but no content, sender or context (19 §21). An operator who doesn't want its users' wake-ups to reach it can setlistedwithout the official gateway; its users' official apps then get no background notifications (20ST.push_not_allowed), while web clients keep Web Push.
14. Open questions
These items need a decision by the owner or the lead, or a change in another document. Each has a recommendation.
| ID | Question | Recommendation |
|---|---|---|
| OQ-21-2 | 15 §8.1 rule 2 (one PeerConnection per device for publishing and subscribing) excludes two widely used open-source SFUs, Janus VideoRoom and LiveKit in its default mode, which use separate publisher and subscriber PeerConnections (§7.3). 00 calls the SFU "any open-source WebRTC SFU" (D-009, D-045). | Let 15 allow up to two SFU sessions per device and call, one per direction, as an additive change. Pion-based SFUs, mediasoup and hosted SFUs keep using one. |
| OQ-21-7 | Should every server implementation support the relay-control binding, so any server can use any third-party relay, rather than only implementations whose relay is a separate program (§6.1 rule 3)? | Keep §6.1 rule 3. A single-binary server gains nothing from exposing the binding, and an operator who wants a third-party relay chooses a server that supports it. Revisit if relay-as-a-service offerings appear. |
| OQ-21-9 | Owners should adopt the restore mechanisms that §11.6 adds, in particular the security journal (PD-21-4). 13 already cites it and has adopted the purge of regular KeyPackages (§11.6.4 step 7; 13 §4.2, §9.3 item 5). The 360 s replay window after a restore (§11.6.4 step 6) stays normative in this document. | 07 §7.3 cites §11.6.1 as the storage that a restore doesn't roll back; 09 §12 and 10 note that upgrades, bans and admin changes are journaled. |
| OQ-21-10 | Re-uploading after a lossy restore. 08 forbids clients to accept rolled-back vault records and vault generations, but nothing makes a client restore what the server lost: a KeyBackup, vault records or an IdentityCertificate and DeviceCertificate registered after the backup point. A recovery key created after that point can then silently stop working. | 07 and 08 add: an enrolled device that sees its home server serve an older igen, an older KeyBackup or an older vault generation than it holds re-registers its IdentityCertificate and DeviceCertificate and re-uploads the KeyBackup and its vault records, without prompting (00 §4.12.5 lists vault sync as never-prompt). |
OQ-21-1 (15 §5.2 now applies 02 §11.6 step 5 to RelayTicket keys) and OQ-21-8 (00 §7.5 and 03 §10.4 allocate relayctl) have been resolved and removed. OQ-21-3 to OQ-21-6 of an earlier draft were already settled elsewhere and have been removed: control-started failover is planned (00 HP-13 item 7, 15 §10.1); the ver jump after a restore is 07 §7.3's 2^32, and verifiers discard states signed by a revoked key (07 §7.5); 13 §9.3 already has mls.keypackages_low and last-resort KeyPackages; and 09 §11.1 already reserves the server upgrade to the admin role.
Proposed decisions made in this document, for the decision log: PD-21-1 (§6.1, the relay-control binding opened by the relay), PD-21-2 (§6.2.3, the relayctl namespace; adopted in 00 §7.5 and 03 §10.4), PD-21-3 (§11.6.4, the restore procedure), PD-21-4 (§11.6.1, the security journal), PD-21-5 (§6.2.1, one control link per relay node and issuer, terminated by a link holder).
15. References
15.1 Normative
- RFC 2119, RFC 8174 — requirement key words
- RFC 5234 — ABNF
- RFC 8259 — JSON; RFC 7493 — I-JSON
- RFC 3339 — timestamps; RFC 9562 — UUIDv7; RFC 4648 — base64url
- RFC 3986 — URIs
- RFC 6455 — the WebSocket protocol
- RFC 9457 — problem details for HTTP APIs
- RFC 8446 — TLS 1.3; RFC 5246 — TLS 1.2
- RFC 7517 — JWK; RFC 8037 — EdDSA in JOSE; RFC 7638 — JWK thumbprint
- RFC 8445 — ICE (including ICE-lite); RFC 6544 — ICE-TCP; RFC 4571 — framing RTP and RTCP over connection-oriented transport; RFC 7675 — ICE consent freshness
- RFC 8831 — WebRTC data channels; RFC 8261 — SCTP over DTLS; RFC 8841 — SDP for SCTP over DTLS
- Sloppy Voice v2 documents 00, 02, 06 and 15 (this document's dependencies), and 03, 04, 05, 07, 08, 09, 10, 11, 12, 13, 14, 16, 17, 18, 19 and 20 where cited;
spec/DECISIONS.md
15.2 Informative
- RFC 8555 — ACME
- RFC 5905 — NTP
- RFC 9420 — MLS; RFC 9750 — MLS architecture; RFC 9605 — SFrame
- RFC 8030, RFC 8291, RFC 8292 — Web Push, its encryption, VAPID
- RFC 8484 — DNS over HTTPS; RFC 8615 — well-known URIs
- RFC 9745 — the
Deprecationheader; RFC 8594 — theSunsetheader - draft-ietf-httpapi-ratelimit-headers-09 — rate-limit headers (pinned in §10.7)
- OpenMetrics specification (CNCF) — metrics exposition format
- Pion WebRTC (
pion/webrtc), and Pion's ICE UDP multiplexing — Go WebRTC stack for relays and SFUs - mediasoup v3 documentation — Router, WebRtcTransport, Producer, Consumer
- Janus WebRTC Server documentation — VideoRoom plugin API
- LiveKit server documentation — RoomService API
- Cloudflare Realtime SFU documentation — sessions and tracks API (one possible deployment, D-009)
- PostgreSQL documentation — continuous archiving and point-in-time recovery; Litestream — SQLite replication