--- title: RTCPeerConnection.connectionState slug: Web/API/RTCPeerConnection/connectionState translation_of: Web/API/RTCPeerConnection/connectionState --- <p>{{APIRef("WebRTC")}}</p> <p>{{domxref("RTCPeerConnection")}} 인터페이스의 읽기 속성인 <strong><code>connectionState</code></strong>는 피어 연결의 현재 상태를 알려줍니다. 이 속성은 <code><a href="#RTCPeerConnectionState_enum">RTCPeerConnectionState</a></code> enum 값 중 하나를 문자열로 반환해줍니다.</p> <p>만약 이 속성의 값이 바뀌게되면, {{domxref("RTCPeerConnection")}} 인스턴스로 {{event("connectionstatechange")}} 이벤트가 전송됩니다.</p> <h2 id="Syntax">Syntax</h2> <pre class="syntaxbox">var <em>connectionState</em> = <em>RTCPeerConnection</em>.connectionState;</pre> <h3 id="값">값</h3> <p>연결의 현재 상태를 <code><a href="#RTCPeerConnectionState_enum">RTCPeerConnectionState</a></code> enum의 값 중 하나로 표시합니다.</p> <h3 id="RTCPeerConnectionState_enum">RTCPeerConnectionState enum</h3> <p><code>RTCPeerConnectionState</code> enum은 <code>RTCPeerConnection</code>이 존재 할 수 도있는 상태에 대해 알려주는 문자열 상수를 정의합니다. 이 값들은 {domxref("RTCPeerConnection.connectionState", "connectionState")}} 속성에 의해 반홥됩니다. 근본적으로 이 상태는 연결에 의해 사용되는 모든 ICE 전송 ({{domxref("RTCIceTransport")}} 혹은 {{domxref("RTCDtlsTransport")}}의 타입)의 상태 집합을 나타냅니다. </p> <table> <thead> <tr> <th scope="col">상수명</th> <th scope="col">설명</th> </tr> </thead> <tbody> <tr> <td><code>"new"</code></td> <td> <p>연결의 ICE 전송 중 적어도 한 개가 새로 만들어진 <code>"new"</code> 상태이고, 그 외의 나머지는 다음의 상태 중 하나가 아니여야 합니다: <code>"connecting"</code>, <code>"checking"</code>, <code>"failed"</code>, 혹은 <code>"disconnected"</code>, 혹은 모든 연결의 전송이 끝났다는 <code>"closed"</code>상태.</p> </td> </tr> <tr> <td><code>"connecting"</code></td> <td>하나 혹은 여러개의 ICE 전송이 현재 연결을 구성하는 중에 있음을 알려주는 값. 이는 <code>RTCIceConnectionState</code>가 <code>"checking"</code> 혹은 <code>"connected"</code>이며, 그 어떤 전송도 <code>"failed"</code>상태가 아니여야합니다. <strong><<< Make this a link once I know where that will be documented</strong></td> </tr> <tr> <td><code>"connected"</code></td> <td>연결에 의해 사용되는 모든 ICE 전송이 사용 중 (<code>"connected"</code> 혹은 <code>"completed"</code>)이거나, 종료된 상태입니다. 추가적으로 최소 하나의 전송이 <code>"connected"</code> 혹은 <code>"completed"</code>입니다.</td> </tr> <tr> <td><code>"disconnected"</code></td> <td>연결에 대한 최소 한 개의 ICE 전송이 <code>"disconnected"</code>상태이고, 그 외의 다른 전송 상태는 <code>"failed"</code>, <code>"connecting"</code>, 혹은 <code>"checking"</code>이 아님을 알려주는 값. </td> </tr> <tr> <td><code>"failed"</code></td> <td> <p>연결에 대한 하나 혹은 여러개의 ICE 전송이 <code>"failed"</code>상태임을 알려주는 값.</p> </td> </tr> <tr> <td><code>"closed"</code></td> <td> <p><code>RTCPeerConnection</code> 개통되지 않음을 알려주는 값.</p> <p>2016년 5월 13일에 작성된 명세서의 초안에 따르면, 이 값은 <a href="#RTCPeerConnectionState_enum"><code>RTCPeerConnectionState</code> enum</a> 안에 존재했었습니다. 따라서, {{domxref("RTCPeerConnection.signalingState", "signalingState")}}의 값을 통해 찾을 수 있습니다. </p> </td> </tr> </tbody> </table> <h2 id="예시">예시</h2> <pre class="brush: js">var pc = new RTCPeerConnection(configuration); /* ... */ var connectionState = pc.connectionState;</pre> <h2 id="명세">명세</h2> <table class="standard-table"> <thead> <tr> <th scope="col">명세</th> <th scope="col">상태</th> <th scope="col">코멘트</th> </tr> </thead> <tbody> <tr> <td>{{ SpecName('WebRTC 1.0', '#widl-RTCPeerConnection-connectionState', 'RTCPeerConnection.connectionState') }}</td> <td>{{ Spec2('WebRTC 1.0') }}</td> <td>Initial specification.</td> </tr> </tbody> </table> <h2 id="브라우저_호환성">브라우저 호환성</h2> <p>{{Compat("api.RTCPeerConnection.connectionState")}}</p> <h2 id="참조">참조</h2> <ul> <li><a href="/en-US/docs/Web/API/WebRTC_API/Session_lifetime">Lifetime of a WebRTC session</a></li> <li>{{domxref("RTCPeerConnection")}}</li> <li>{{event("connectionstatechange")}}</li> <li><a href="/en-US/docs/Web/Guide/API/WebRTC">WebRTC</a></li> </ul>