--- title: RTCPeerConnection.connectionState slug: Web/API/RTCPeerConnection/connectionState translation_of: Web/API/RTCPeerConnection/connectionState ---
{{APIRef("WebRTC")}}
{{domxref("RTCPeerConnection")}} 인터페이스의 읽기 속성인 connectionState는 피어 연결의 현재 상태를 알려줍니다. 이 속성은 RTCPeerConnectionState enum 값 중 하나를 문자열로 반환해줍니다.
만약 이 속성의 값이 바뀌게되면, {{domxref("RTCPeerConnection")}} 인스턴스로 {{event("connectionstatechange")}} 이벤트가 전송됩니다.
var connectionState = RTCPeerConnection.connectionState;
연결의 현재 상태를 RTCPeerConnectionState enum의 값 중 하나로 표시합니다.
RTCPeerConnectionState enum은 RTCPeerConnection이 존재 할 수 도있는 상태에 대해 알려주는 문자열 상수를 정의합니다. 이 값들은 {domxref("RTCPeerConnection.connectionState", "connectionState")}} 속성에 의해 반홥됩니다. 근본적으로 이 상태는 연결에 의해 사용되는 모든 ICE 전송 ({{domxref("RTCIceTransport")}} 혹은 {{domxref("RTCDtlsTransport")}}의 타입)의 상태 집합을 나타냅니다.
| 상수명 | 설명 |
|---|---|
"new" |
연결의 ICE 전송 중 적어도 한 개가 새로 만들어진 |
"connecting" |
하나 혹은 여러개의 ICE 전송이 현재 연결을 구성하는 중에 있음을 알려주는 값. 이는 RTCIceConnectionState가 "checking" 혹은 "connected"이며, 그 어떤 전송도 "failed"상태가 아니여야합니다. <<< Make this a link once I know where that will be documented |
"connected" |
연결에 의해 사용되는 모든 ICE 전송이 사용 중 ("connected" 혹은 "completed")이거나, 종료된 상태입니다. 추가적으로 최소 하나의 전송이 "connected" 혹은 "completed"입니다. |
"disconnected" |
연결에 대한 최소 한 개의 ICE 전송이 "disconnected"상태이고, 그 외의 다른 전송 상태는 "failed", "connecting", 혹은 "checking"이 아님을 알려주는 값. |
"failed" |
연결에 대한 하나 혹은 여러개의 ICE 전송이 |
"closed" |
2016년 5월 13일에 작성된 명세서의 초안에 따르면, 이 값은 |
var pc = new RTCPeerConnection(configuration); /* ... */ var connectionState = pc.connectionState;
| 명세 | 상태 | 코멘트 |
|---|---|---|
| {{ SpecName('WebRTC 1.0', '#widl-RTCPeerConnection-connectionState', 'RTCPeerConnection.connectionState') }} | {{ Spec2('WebRTC 1.0') }} | Initial specification. |
{{Compat("api.RTCPeerConnection.connectionState")}}