createWebRTCClient - Cognigy Documentation
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
| Parameter | Type | Description | Required |
|---|---|---|---|
config |
WebRTCClientConfig |
Configuration object for the client. | Yes |
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
Last modified on April 21, 2026.