Configure ICE server URLs

It is possible to configure your own Interactive Connectivity Establishment (ICE) servers if you need to.

STUN and TURN servers are needed for WebRTC to work because of potential network connectivity issues due to NAT and firewalls. A STUN server is used to get an external network address. TURN servers are used to relay traffic if a direct (peer to peer) connection fails. You are therefore able to configure your own STUN or TURN servers if required.

The default is stun:stun.l.google.com:19302.

Configuration

You can specify your STUN or TURN server URL when you create the Client SDK NexmoClient object:

// configure STUN server
const config = {
  iceServers: [
    {
      urls: ['stun:stun.l.google.com:19302', ...]
    }
  ]
}
const nexmoClient = new NexmoClient(config);

// Configure TURN server
const config = {
  iceServers: [
    {
      urls: ['turn:turn.l.google.com:19302', ...],
      username: 'username',
      credential: 'password'
    }
  ]
}
const nexmoClient = new NexmoClient(config);
val nexmoClient = NexmoClient.Builder()
    .iceServerUrls(arrayOf("STUN1_URL"))
    .build(context)
NexmoClient client = new NexmoClient.Builder()
    .iceServerUrls(new String[]{"STUN1_URL"})
    .build(context);
let config = NXMClientConfig(apiUrl: restUrl, websocketUrl: wsUrl, ipsUrl: ipsUrl, iceServerUrls: iceUrls)
NXMClient.setConfiguration(config)

// NOTE: You must call `setConfiguration` method before using `NXMClient.shared`.
NXMClientConfig *config = [[NXMClientConfig alloc] initWithApiUrl:restUrl websocketUrl:wsUrl ipsUrl:ipsUrl iceServerUrls:iceUrls];
[NXMClient setConfiguration:config]
// NOTE: You must call `setConfiguration` method before using `NXMClient.shared`.