Skip to main content

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

OptionTypeDefaultNotes
apiDomainstringTelAPI domain used to build REST and WebSocket URLs.
apiKeystringAPI key for session-token requests. Optional if sessionTokenUrl proxies auth.
sessionTokenUrlstringSame-origin proxy override for session-token requests. Use when the browser must not see the raw apiKey.
runtimeCapabilitiesUrlstringSame-origin proxy override for /runtime/capabilities.
sessionIdleTimeoutMsnumber300_000Auto-close idle non-voice sessions. 0 disables. Voice sessions ignore this.
iceServersRTCIceServer[]derived from session tokenCustom WebRTC ICE servers. When omitted, the SDK derives them from telproDomain returned in the session-token response.
preferPcmabooleantruePrefer PCMA over Opus so the WebRTC gateway can skip transcoding.
loggerLoggerconsoleCustom 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.

Production guidance

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 same EndpointCapabilities shape as delphi.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.