Dominevo
ReferenceDevice capabilities

webrtc-session

WebRTC session — device-scoped facade over the system webrtc cap.

WebRTC session — device-scoped facade over the system webrtc cap.

Exposes per-device signaling (createSession, handleAnswer, closeSession) on the device proxy so UI / integrations can negotiate a session by (deviceId, profile) instead of constructing an opaque ${deviceId}/${profile} streamId string. The provider is registered by the stream-broker addon for every camera device with at least one active profile slot; internally it resolves ${deviceId}/${profile} and forwards to the system webrtc provider.

The system webrtc cap remains available for cross-device / raw streamId callers (debugging, admin tools). Production UI should prefer this device-scoped cap.

At a glance

Capabilitywebrtc-session
Provided byAn addon wraps the device and provides it. It is bound to a device through the device bindings and can be bound automatically to compatible devices.
Active providers per deviceone
Device typescamera
Sourcepackages/types/src/capabilities/webrtc-session.cap.ts

Methods

Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.

MethodKindRequired of a providerAccess
listStreamsqueryyesdefault
createSessionmutationyesdefault
handleOffermutationyesdefault
handleAnswermutationyesdefault
addIceCandidatemutationyesdefault
getIceCandidatesqueryyesdefault
closeSessionmutationyesdefault
hasAdaptiveBitratequeryyesdefault
getSessionStatequeryyesdefault
applyDownlinkProbemutationyesdefault
getSessionDebugqueryyesdefault

listStreams

query

List available WebRTC streams for a device. Returns adaptive (if any profile is assigned) + each assigned profile with codec/resolution info. UI renders this directly — no hardcoded profile names needed.

Input

No fields besides deviceId.

Output

({ id: string; label: string; target: { kind: "adaptive" } | { kind: "profile"; profile: "high" | "mid" | "low" } | { kind: "cam-stream"; camStreamId: string }; codec: string | null; resolution: { width: number; height: …

createSession

mutation

Open a WebRTC session against a specific target on the device. target.kind discriminates between adaptive selection, a profile slot, or a specific cam stream source — see WebrtcStreamTarget. The server resolves the target to a live broker; clients never build or parse brokerId strings.

Input

FieldTypeRequiredDescription
target{ kind: "adaptive" } | { kind: "profile"; profile: "high" | "mid" | "low" } | { kind: "cam-stream"; camStreamId: string }yes
hints{ viewportWidth?: number; viewportHeight?: number; devicePixelRatio?: number; downlinkMbps?: number; prefersTier?: string; intent?: "live" | "clip" }no
relayOnlybooleannoSERVER-INJECTED — NOT a client hint. The hub layer that holds the tRPC request context (and therefore the client IP) sets this to true when the viewer's source IP is non-LAN (4G/CGNAT/internet). The broker then forces TURN-relay-only ICE for the session so a CGNAT client (which can only offer a relay candidate) gets a clean relay↔relay media path instead of werift nominating a dead host/hairpin-srflx pair. LAN clients leave this absent/false and keep the low-latency direct (host/srflx) path. Clients MUST NOT send this — the server overwrites it from the request context.
consumerAttribution{ kind: "alexa" | "homekit" | "webrtc-browser" | "webrtc-mobile" | "webrtc-whep" | "rtsp-listen" | "derived-broker" | "recording" | "pipeline" | "snapshot" | "warmup" | "unknown"; label?: string; media?: "audio" | "video…noSubscriber attribution surfaced in the stream-broker widget's client list. Callers (Alexa addon, browser hooks, WHEP server) populate kind and any of label/userId/sessionId/ remoteAddr they know. The hub layer enriches remoteAddr from the tRPC request context.

Output

FieldTypeRequiredDescription
sessionIdstringyes
sdpOfferstringyes

handleOffer

mutation

Accept a CLIENT-generated SDP offer and return the server's SDP answer. Mirrors the WHEP / Alexa Alexa.RTCSessionController.InitiateSessionWithOffer direction (client offers, server answers) — the dual of createSession, which has the server offer first.

target defaults to the device's adaptive selection when omitted; an optional sessionId lets the client provide its own correlation id (Alexa supplies one in the directive payload). The returned sessionId is whatever the server uses to track the session and accepts via closeSession.

Input

FieldTypeRequiredDescription
target{ kind: "adaptive" } | { kind: "profile"; profile: "high" | "mid" | "low" } | { kind: "cam-stream"; camStreamId: string }no
sdpOfferstringyes
sessionIdstringno
relayOnlybooleannoForce TURN-relay-only ICE for this session. Two kinds of caller set it: A cloud peer like Alexa's RTCSessionController (reachable only via TURN, never our host/srflx behind NAT) passes true from its own trusted addon context. The hub injects it for browser client-offer viewers from the request's source IP (non-LAN ⇒ true), exactly as it does for createSession. A LAN/Tailscale browser doing client-offer passthrough leaves it absent/false so a direct host pair carries full native quality. Untrusted browser clients MUST NOT send it — the hub overwrites it from the request context.
nonTricklebooleannoForce a NON-TRICKLE answer: the server awaits ICE gathering to COMPLETE and returns a full-candidate answer SDP (with a=candidate lines) instead of the default bare/trickle answer. Set true by callers that DON'T support trickle ICE — notably Alexa's RTCSessionController, which never polls getIceCandidates nor trickles back via addIceCandidate, so without server candidates in the answer SDP its ICE agent stalls (no nominated pair → DTLS never connects → Echo shows black → SessionDisconnected). Browser viewers leave it absent/false: they poll getIceCandidates and trickle, so the bare answer lets media start in ~0s instead of blocking on full gathering.
disableTurnbooleannoSuppress TURN servers from the per-session iceConfig: the answer will carry ONLY host + srflx candidates, never a relay one. Set true by peers that are themselves directly reachable on the public internet (Alexa's RTCSessionController media gateway is AWS-hosted with public host candidates). Including a TURN relay for such a peer is counterproductive: (a) gathering blocks on the TURN allocation round-trip and slows the answer; (b) werift spends ICE-checking budget on a relay-pair that the peer cannot use, sometimes stalling the host/srflx pair validation enough that Echo's agent times out before nominating one — visible as 'ICE checking → DTLS never connected'. Browser viewers leave it absent/false so the relay candidate remains as a fallback for symmetric-NAT clients. Independent from relayOnly. relayOnly: true forces ICE to a relay-only pair set; disableTurn: true strips the relay candidate entirely. They are mutually exclusive in practice but not policed at the schema level — callers MUST NOT set both.
disableIpv6booleannoSuppress IPv6 host candidates from gathering and from additionalHostAddresses. The answer SDP will contain only IPv4 host/srflx (and TURN, unless disableTurn is also set). Set true by peers that document IPv4-only ICE — Amazon's Alexa.RTCSessionController spec states: "For ICE candidates, you can use either UDP or TCP but you must use IPv4." Echo's media gateway ignores IPv6 candidates and they consume budget against the gateway's documented 6-second SDP processing limit. Browser viewers leave it absent/false so IPv6-only paths (Tailscale, native dual-stack) remain available.
consumerAttribution{ kind: "alexa" | "homekit" | "webrtc-browser" | "webrtc-mobile" | "webrtc-whep" | "rtsp-listen" | "derived-broker" | "recording" | "pipeline" | "snapshot" | "warmup" | "unknown"; label?: string; media?: "audio" | "video…noSubscriber attribution. See createSession for the contract.
hints{ viewportWidth?: number; viewportHeight?: number; devicePixelRatio?: number; downlinkMbps?: number; prefersTier?: string; intent?: "live" | "clip" }noClient-side stream hints (viewport, downlink) — same contract as createSession.hints. Client-offer viewers (the RN viewer's WebrtcLiveSession) negotiate via handleOffer, so without this field their hints were silently stripped by the schema and the adaptive ladder started blind on the client's display size.
talkbackbooleannoTalk-back: relay the PEER's audio to the device's speaker through the intercom cap's push-talk triple. When true and the offer lets the peer send audio, the answer's audio is sendrecv and every inbound frame goes to intercom.pushTalkAudio for this deviceId; absent/false answers sendonly, as for every viewer. TRUSTED-CALLER ONLY. Set by the Alexa export for an Echo on a camera with intercom, when the linked user may control that camera. The hub STRIPS it from every request-bound call (a browser), exactly as it overwrites relayOnly — a viewer's talk permission is the intercom cap's own surface (share tokens gate it there), and this flag must not become a second door to the camera's speaker.

Output

FieldTypeRequiredDescription
sessionIdstringyes
sdpAnswerstringyes

handleAnswer

mutation

Input

FieldTypeRequiredDescription
sessionIdstringyes
sdpAnswerstringyes

Output

Nothing.

addIceCandidate

mutation

Trickle ICE — add a remote (client) ICE candidate to a live session. Lets the client send its SDP offer/answer IMMEDIATELY (before ICE gathering finishes) and deliver candidates as they arrive, so the connection establishes in ~0s instead of waiting for full gathering. The dual of getIceCandidates in the trickle-ICE signaling exchange.

Input

FieldTypeRequiredDescription
sessionIdstringyes
candidatestringyes
sdpMidstring | nullno
sdpMLineIndexnumber | nullno

Output

Nothing.

getIceCandidates

query

Trickle ICE — poll the server's gathered ICE candidates for a session. The server answers immediately (no gathering wait) and the client polls this to receive host/srflx/relay candidates as werift gathers them, adding each to its PeerConnection. Returns all candidates gathered so far; the client dedupes. done flips true once gathering completes.

Input

FieldTypeRequiredDescription
sessionIdstringyes

Output

FieldTypeRequiredDescription
candidates({ candidate: string; sdpMid: string | null; sdpMLineIndex: number | null })[]yes
donebooleanyes

closeSession

mutation

Input

FieldTypeRequiredDescription
sessionIdstringyes

Output

Nothing.

hasAdaptiveBitrate

query

Whether the underlying provider supports adaptive bitrate for this profile.

Input

FieldTypeRequiredDescription
profile"high" | "mid" | "low"yes

Output

boolean

getSessionState

query

Poll the live signaling state of a session. pendingRenegotiation is non-null after an adaptive tier switch — the client re-offers on the same sessionId; epoch guards against acting on a stale poll twice.

Input

FieldTypeRequiredDescription
sessionIdstringyes

Output

FieldTypeRequiredDescription
pendingRenegotiation{ target: { kind: "adaptive" } | { kind: "profile"; profile: "high" | "mid" | "low" } | { kind: "cam-stream"; camStreamId: string }; epoch: number } | nullyes
alivebooleanyesWhether the session still EXISTS. A consumer that holds a resource for the life of a session needs to be able to ask, because a session does not always end the way it began. Measured on this hub 2026-09-13: an Echo that got stuck never sent SessionDisconnected, so the Alexa exporter's releaseEgressTranscode never ran, and a 2304x1296 HEVC to 720p H.264 transcode kept running for NOBODY for more than twenty minutes. The WebRTC session had logged WebRTC session closed minutes earlier — the broker knew; the holder had no way to ask. false for a session id the provider has never heard of, which is the same answer as "it ended": either way nothing is holding it up.

applyDownlinkProbe

mutation

The viewer's downlink probe, for ONE live session.

The player measures /adaptive-probe after the session's first decoded frame. It now hands the measurement to the session it already has; the provider picks the rung exactly as it would from an offer's hints (same viewport ceiling) and moves the session there — in place when the negotiated codec carries the new rendition, by the existing re-offer (getSessionState.pendingRenegotiation) when it cannot.

A MEASUREMENT, never a tier: the client does not choose. A probe only raises the rung; lowering it stays the ladder's call on delivery. held answers why nothing moved (not-adaptive, pinned, already-there, recorded, …) — a client that gets ANY answer must not fall back to a reconnect; only a provider that does not know the method (an older hub) leaves the client its legacy second session.

Input

FieldTypeRequiredDescription
sessionIdstringyes
downlinkMbpsnumberyes

Output

FieldTypeRequiredDescription
outcome"switching" | "held"yes
tier"high" | "mid" | "low" | nullyes
reasonstringyes

getSessionDebug

query

The SERVER's half of the stream-debug overlay, for one live session.

The client can measure its own transport (getStats()); it cannot see which rung auto actually resolved to, why the ladder last moved, or whether the rung it is being served is the camera's own encode or something this hub built. That asymmetry is why "quality is stuck on low" reports have historically been unanswerable from the viewer alone.

EVERY measurement here is nullable and null means UNKNOWN, never zero: a session whose ladder has never moved reports lastDecision: null, which is a different fact from a ladder that moved for healthy with a 0 loss ratio.

Read-only, ~1 Hz, polled by the overlay only while it is visible.

Input

FieldTypeRequiredDescription
sessionIdstringyes

Output

What the SERVER decided for one WebRTC session — the half the client cannot measure. See getSessionDebug.

FieldTypeRequiredDescription
sessionIdstringyes
alivebooleanyesWhether the session still exists here. Everything below is null when it does not — a dead session has no measurements, not zero ones.
observedAtnumberyesEpoch ms this snapshot was taken, so the overlay can show its age.
brokerIdstring | nullyesThe broker actually feeding this session (<deviceId>/<camStreamId>).
camStreamIdstring | nullyes
sourceKind"native" | "derived" | "unknown"yesderived = this hub BUILT the rung being served (a transcode/scale of another stream); native = the camera's own encode.
adaptivebooleanyesWhether the ladder is running at all (an adaptive target).
servedTier"high" | "mid" | "low" | nullyesThe rung auto ACTUALLY resolved to right now. Null when the broker is bound to no profile slot (a manually-activated stream).
ingestNodeIdstring | nullyesWhich node ingests the source. Null when unresolved.
ingestIsRemoteboolean | nullyesWhether that node is a remote one (the media crosses a node boundary before it reaches this session). Null when unresolved.
sourceCodecstring | nullyesCodec off the source, and the one negotiated with this client.
negotiatedCodecstring | nullyes
egressLeg"copy" | "transcode" | "unknown"yesWhether the EGRESS leg re-encodes for this client or forwards the source bytes untouched.
brokerStatusstring | nullyesWhat the broker itself reports about the rung it is serving.
brokerCodecstring | nullyes
brokerBitrateKbpsnumber | nullyes
brokerInputFpsnumber | nullyes
brokerUptimeMsnumber | nullyes
rtpPacketsSentnumber | nullyesRTP packets this session has sent — the server's own "am I sending?".
trackMode"live" | "recorded" | nullyesThe ladder is suspended there, so a frozen picture in recorded mode means something entirely different.
lastDecision{ cause: "loss" | "stall" | "healthy"; tier: "high" | "mid" | "low" | null; forcedTranscodeDown: boolean; lossRatio: number | null; clientKbps: number | null; stalledForMs: number | null; serverSending: boolean | null; a…yes
tierFailures({ tier: "high" | "mid" | "low"; failures: number })[]yes
upgradeCountnumber | nullyesSuccessful promotions in this viewer session (drives the progressive healthy timer). Null when no ladder is running.
climbHold{ code: string; nextTier: "high" | "mid" | "low"; deliveryRatio: number | null; deliveryWindowMs: number | null; climbDeliveryRatio: number; capacityKbps: number | null; probeKbps: number | null; nextTierKbps: number | n…noWhy the ladder is not climbing right now. Null when no ladder runs, it is at the top rung, or it just moved. Optional because this output is validated by the router: a server carrying this schema must still accept the answer of a stream-broker deployed before the field existed.