RTCPeerConnection: sự kiện connectionstatechange
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since May 2023.
Sự kiện connectionstatechange của giao diện RTCPeerConnection được gửi khi trạng thái kết nối tổng thể của RTCPeerConnection thay đổi.
Cú pháp
js
addEventListener("connectionstatechange", (event) => { })
onconnectionstatechange = (event) => { }
Loại sự kiện
Một Event chung.
Ví dụ
js
pc.addEventListener("connectionstatechange", () => {
console.log(pc.connectionState);
});
Thông số kỹ thuật
| Specification |
|---|
| WebRTC: Real-Time Communication in Browsers> # dom-rtcpeerconnection-onconnectionstatechange> |