A shim to insulate apps from WebRTC spec changes and browser prefix differences
Overall
score
98%
Build a connection state monitoring utility that tracks the overall connection state of WebRTC peer connections and notifies listeners of state changes.
Your utility should:
new, connecting, connected, disconnected, failed, closedconnectionState property is not availableWhen deriving connection state from ICE connection state, apply these mappings:
completed → connection state connectedchecking → connection state connectingnew to checking, listeners are notified with connection state connecting @testcompleted, listeners are notified with connection state connected @testfailed, listeners are notified with connection state failed @test@generates
/**
* Creates a connection state monitor for a peer connection.
*
* @param {RTCPeerConnection} peerConnection - The peer connection to monitor
* @param {Function} onStateChange - Callback invoked when connection state changes, receives new state as string
* @returns {Object} Monitor object with a cleanup method
*/
function createConnectionStateMonitor(peerConnection, onStateChange) {
// Implementation
}
module.exports = {
createConnectionStateMonitor
};Provides cross-browser compatibility for WebRTC APIs including connection state normalization.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-webrtc-adapterdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10