RTCPeerConnectionIceErrorEvent: address property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
TheRTCPeerConnectionIceErrorEvent propertyaddress is a string which indicates the local IP addressbeing used to communicate with theSTUN orTURN serverduring negotiations. The error which occurred involved this address.
In this article
Value
A string which specifies the local IP address of the networkconnection to the ICE server with which negotiations were occurring when the erroroccurred. This address identifies the network interface on the local device which isbeing used to attempt to establish the connection to the remote peer.
This can be useful on multi-homed systems—devices with more than one networkconnection—to determine which network interface is being used. For example, on a mobilephone, there are typically at least two network interfaces available: the cellularconnection and a Wi-Fi connection.
If the local IP address isn't exposed as part of a local candidate, the value ofaddress isnull.
Examples
This example creates a handler foricecandidateerror eventswhich creates human-readable messages describing the local network interface for theconnection as well as the ICE server that was being used to try to open the connection,then calls a function to display those as well as the event'serrorText property'scontents.
pc.addEventListener("icecandidateerror", (event) => { let networkInfo = `[Local interface: ${event.address}:${event.port}`; let iceServerInfo = `[ICE server: ${event.url}`; showMessage(errorText, iceServerInfo, networkInfo);});Specifications
| Specification |
|---|
| WebRTC: Real-Time Communication in Browsers> # dom-rtcpeerconnectioniceerrorevent-address> |