RTCPeerConnection.connectionState

 

connectionState 只读,说明当前连接状态。状态值参见RTCPeerConnectionState ,值由一个peer connection返回。

值变化时,一个connectionstatechange 事件发送给RTCPeerConnection对象实例中。

Syntax

var connectionState = RTCPeerConnection.connectionState;

Value

The current state of the connection, as a value from the enum RTCPeerConnectionState.

{{page("/en-US/docs/Web/API/RTCPeerConnection", "RTCPeerConnectionState enum", 0, 1)}}

Example

var pc = new RTCPeerConnection(configuration);

/* ... */

var connectionState = pc.connectionState;

Specifications

Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browsers
RTCPeerConnection.connectionState
Candidate Recommendation Initial specification.

Browser compatibility

BCD tables only load in the browser

See also