June 2024
Beginner to intermediate
268 pages
6h 26m
English
The RTCPeerConnection interface provides two features that simplify working with peer-connection states: an onconnectionstatechange property for attaching a callback function, and a connectionState property for determining what state the connection is in. (Note the WebRTC connectionState differs from the signalingState that appeared as part of the the perfect-negotiation code in the last chapter).
You can define a handleRtcConnectionStateChange() callback function, right alongside the other peer-connection callbacks you’ve already written. To start, write a call to console.log to get a sense of how the connection state changes as a call is established. A local connection_state variable will make it easier ...
Read now
Unlock full access