This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The read-only property
RTCPeerConnection.iceConnectionState returns an enum of type
RTCIceConnectionState which state of the ICE agent associated with the
You can detect when this value has changed by watching for the
var state = RTCPeerConnection.iceConnectionState;
The current state of the ICE agent and its connection. The value is one of the strings in the
||The ICE agent is gathering addresses or is waiting to be given remote candidates through calls to
||The ICE agent has been given one or more remote candidates and is checking pairs of local and remote candidates against one another to try to find a compatible match, but has not yet found a pair which will allow the peer connection to be made. It's possible that gathering of candidates is also still underway.|
||A usable pairing of local and remote candidates has been found for all components of the connection, and the connection has been established. It's possible that gathering is still underway, and it's also possible that the ICE agent is still checking candidates against one another looking for a better connection to use.|
||The ICE agent has finished gathering candidates, has checked all pairs against one another, and has found a connection for all components.|
||The ICE candidate has checked all candidates pairs against one another and has failed to find compatible matches for all components of the connection. It is, however, possible that the ICE agent did find compatible connections for some components.|
||Checks to ensure that components are still connected failed for at least one component of the
||The ICE agent for this
var pc = new RTCPeerConnection(); var state = pc.iceConnectionState;
|WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCPeerConnection.iceConnectionState' in that specification.
|Working Draft||Initial specification.|
|Feature||Chrome||Edge||Firefox (Gecko)||Internet Explorer||Opera||Safari|
|Basic support||(Yes)||(Yes)||22 (22) ||No support||(Yes)||?|
|Feature||Android Webview||Chrome for Android||Edge||Firefox Mobile (Gecko)||IE Mobile||Opera Mobile||Safari Mobile|
|Basic support||(Yes)||(Yes)||(Yes)||22 (22) ||No support||?||?|
 Though this property is not prefixed, the interface it belongs to was until Chrome 56.
Though this property is not prefixed, the
RTCPeerConnection interface it belongs to is, until Firefox 44.