Esta página foi traduzida do inglês pela comunidade. Saiba mais e junte-se à comunidade MDN Web Docs.

View in English Always switch to English

RTCPeerConnection.connectionState

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨maio de 2023⁩.

A propriedade connectionState do tipo somente leitura da interface RTCPeerConnection indica o estado atual da conexão em par, devolvendo um valor em string específicado por um enum RTCPeerConnection.

Quando o valor da propriedade muda, o evento connectionstatechange é enviado para a intância RTCPeerConnection.

Syntax

var connectionState = RTCPeerConnection.connectionState;

Value

O estado atual da conexão, como um valor do enum RTCPeerConnectionState.

Example

js
var pc = new RTCPeerConnection(configuration);

/* ... */

var connectionState = pc.connectionState;

Especificações

Specification
WebRTC: Real-Time Communication in Browsers
# dom-peerconnection-connection-state

Compatibilidade com navegadores

See also