Skip to main content
Creates and returns a new WebRTCClient instance. This is the main entry point of the SDK.

Signature

import { createWebRTCClient } from '@cognigy/click-to-call-sdk';

const client = await createWebRTCClient(config: WebRTCClientConfig);

Parameters

ParameterTypeDescriptionRequired
configWebRTCClientConfigConfiguration object for the clientYes

Returns

Promise<WebRTCClient> — a configured client instance ready to connect and make calls.

Example

import { createWebRTCClient } from '@cognigy/click-to-call-sdk';

const client = await createWebRTCClient({
  endpointUrl: 'https://your-api.com/voice-connect-config',
  userId: 'user-123',
});

With Custom ICE Servers

const client = await createWebRTCClient({
  endpointUrl: 'https://your-api.com/voice-connect-config',
  userId: 'user-123',
  pcConfig: {
    iceServers: [
      { urls: 'stun:stun.l.google.com:19302' },
      { urls: 'turn:your-turn-server.com:3478', username: 'user', credential: 'password' }
    ]
  }
});

More Information