ICE-Server-URLs konfigurieren
Es ist möglich, bei Bedarf eigene ICE-Server (Interactive Connectivity Establishment) zu konfigurieren.
STUN- und TURN-Server sind erforderlich, damit WebRTC funktioniert, da es aufgrund von NAT und Firewalls zu Problemen mit der Netzwerkkonnektivität kommen kann. Ein STUN-Server wird verwendet, um eine externe Netzwerkadresse zu erhalten. TURN-Server werden verwendet, um den Datenverkehr weiterzuleiten, wenn eine direkte (Peer-to-Peer-) Verbindung ausfällt. Sie können daher bei Bedarf Ihre eigenen STUN- oder TURN-Server konfigurieren.
Der Standardwert ist stun:stun.l.google.com:19302.
Konfiguration
Sie können die URL Ihres STUN- oder TURN-Servers angeben, wenn Sie das Client SDK erstellen NexmoClient Objekt:
// 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()
config.apiUrl = restUrl
config.websocketUrl = wsUrl
config.ipsUrl = ipsUrl
config.iceServerUrls = iceUrls
NXMClient.setConfiguration(config)
// NOTE: You must call `setConfiguration` method before using `NXMClient.shared`.
NXMClientConfig *config = [[NXMClientConfig alloc] init];
config.apiUrl = restUrl;
config.websocketUrl = wsUrl;
config.ipsUrl = ipsUrl;
config.iceServerUrls = iceUrls;
[NXMClient setConfiguration:config];
// NOTE: You must call `setConfiguration` method before using `NXMClient.shared`.