files/en-us/web/api/rtcpeerconnection/iceconnectionstate/index.md
{{APIRef("WebRTC")}}
The iceConnectionState read-only property of the {{domxref("RTCPeerConnection")}} interface returns a string which state of the {{Glossary("ICE")}} agent associated with the {{domxref("RTCPeerConnection")}}: new, checking, connected, completed, failed, disconnected, and closed.
It describes the current state of the ICE agent and its connection to the ICE server; that is, the {{Glossary("STUN")}} or {{Glossary("TURN")}} server.
You can detect when this value has changed by watching for the {{DOMxRef("RTCPeerConnection.iceconnectionstatechange_event", "iceconnectionstatechange")}} event.
The current state of the ICE agent and its connection. The value is one of the following strings:
new
checking
connected
completed
failed
disconnected
failed and may trigger intermittently and resolve just as spontaneously on less reliable networks, or during temporary disconnections.
When the problem resolves, the connection may return to the connected state.closed
const pc = new RTCPeerConnection();
const state = pc.iceConnectionState;
{{Specifications}}
{{Compat}}