Configuration
Pass an options object to the DelphiClient constructor:
import {DelphiClient} from '@ki-kombinat/delphi-client-js-sdk';
const delphi = new DelphiClient({
apiDomain: 'api.delphi.ki-kombinat.com',
apiKey: 'sk_live_…',
sessionTokenUrl: '/api/proxy/sessions/token',
runtimeCapabilitiesUrl: '/api/proxy/runtime/capabilities',
sessionIdleTimeoutMs: 300_000,
iceServers: [
{urls: 'stun:stun.example.com:3478'},
{urls: 'turn:turn.example.com:3478', username: 'u', credential: 'p'},
],
preferPcma: true,
logger: console,
});
Options
| Option | Type | Default | Notes |
|---|---|---|---|
apiDomain | string | — | TelAPI domain used to build REST and WebSocket URLs. |
apiKey | string | — | API key for session-token requests. Optional if sessionTokenUrl proxies auth. |
sessionTokenUrl | string | — | Same-origin proxy override for session-token requests. Use when the browser must not see the raw apiKey. |
runtimeCapabilitiesUrl | string | — | Same-origin proxy override for /runtime/capabilities. |
sessionIdleTimeoutMs | number | 300_000 | Auto-close idle non-voice sessions. 0 disables. Voice sessions ignore this. |
iceServers | RTCIceServer[] | derived from session token | Custom WebRTC ICE servers. When omitted, the SDK derives them from telproDomain returned in the session-token response. |
preferPcma | boolean | true | Prefer PCMA over Opus so the WebRTC gateway can skip transcoding. |
logger | Logger | console | Custom logger with { debug, info, warn, error }. |
Where the WebRTC gateway URL comes from
There is no webrtcGatewayUrl SDK option. For voice calls, the WebRTC gateway WebSocket URL is returned per-session by your backend in the session-token response (SessionTokenResponse.webrtcGatewayUrl) alongside telproDomain. This lets the server route per session (region, A/B, swap implementations) without an SDK config push.
In production, keep apiKey server-side and front the SDK with sessionTokenUrl pointing at your backend proxy. The browser then never holds a long-lived credential.
Same-origin proxies
Both sessionTokenUrl and runtimeCapabilitiesUrl accept absolute or same-origin paths. The expected response shapes are:
POST <sessionTokenUrl>→SessionTokenResponse(sessionId,wsToken,wsUrl,telproDomain,webrtcGatewayUrl).GET <runtimeCapabilitiesUrl>?endpointId=<id>→ the sameEndpointCapabilitiesshape asdelphi.getCapabilities(endpointId)returns.
A reference reverse-proxy lives in the platform's apps/portal package; see the platform docs for setup.
Next step
Capabilities — how to discover what an endpoint supports before opening a session.