Configuration
Provider-neutral OpenRTC options for browser and native apps
Entry points
import { OpenRTC as OpenRTCWeb } from 'openrtc';
import { OpenRTC as OpenRTCNative } from 'openrtc/native';
import { createBridge } from 'openrtc-tauri/ipc';
const web = OpenRTCWeb({ apiKey });
const native = OpenRTCNative({ apiKey }, createBridge());
Both constructors are side-effect free. The native-only entrypoint omits the
WASM loader and uses the installed openrtc-tauri host bridge for secure
device-key operations and the Rust runtime.
Options
| Option | Type | Purpose |
|---|---|---|
apiKey | string | Required public application key. |
auth | AuthProvider | Optional consumer-owned identity assertion source. |
trust.attestation | AttestationProvider | Optional managed attestation evidence source. |
usage | object | Estimates, callbacks, warning threshold, and local session ceiling. |
transports | object | Runtime transport preferences and advanced opt-ins. |
Service endpoints and platform identity are derived from the API key. Endpoint overrides exist only in openrtc/testing and are not part of production application configuration.
Transport preferences
The minimal setup is usually no setup:
const rtc = OpenRTC({ apiKey });
OpenRTC uses the routes supported by both peers and skips unsupported entries.
transports.relay defaults to true. Set it to false when this client must
use direct peer-to-peer routes only:
const rtc = OpenRTC({
apiKey,
transports: {
webrtc: true,
relay: false,
},
});
Direct-only mode disables Iroh relay discovery, relayed WebRTC ICE, and MoQ
while retaining direct ICE for the webrtc Iroh carrier, native LAN/direct
QUIC, and available BLE routes. A browser
behind restrictive NAT can therefore fail to connect. The developer app's
manifest is the ceiling: a client can opt out with relay: false, but cannot
enable relay when the app has disabled it.
For an address-private deployment, opt in explicitly:
const rtc = OpenRTC({
apiKey,
transports: {
iroh: true,
relay: true,
privacy: 'relay-only',
},
});
relay-only is a hard, fail-closed peer-address policy. It disables LAN,
direct QUIC, BLE, and non-relay WebRTC ICE candidates. It does not make the
user anonymous to OpenRTC, the relay operator, the identity provider, or the
billing system. privacy: 'relay-only' requires effective relay access;
activation fails when either the app manifest or transports.relay disables
relay.
Advanced consumers can select an objective and exact fallback order:
const rtc = OpenRTC({
apiKey,
transports: {
iroh: true,
relay: true,
webrtc: true,
moq: {
relayUrl: 'https://draft14-relay.example.com/moq',
accessToken: await shortLivedMoqToken(),
},
optimizeFor: 'lowest-latency',
priority: [
'iroh-lan',
'iroh-quic',
'webrtc',
'moq',
'iroh-relay',
],
},
});
balanced is the default objective. lowest-latency uses passive, proven RTT
samples and conservative hysteresis; it does not race carriers or create extra
gateway operations. Exact priority orders enabled routes but does not enable a
transport by itself.
MoQ, BLE, and relay require portal permission as well as runtime opt-in. A
priority entry cannot restore a relay route removed by relay: false. Ordinary
avenues stop at 8 peers. Reviewed non-room avenues may request at most 12.
This 2.5 release admits at most 50 members to a room or space; eligible
latest-state rooms may use the sparse four-neighbor channel-gossip policy.
Preferences cannot raise platform or budget ceilings.