June 2024
Beginner to intermediate
268 pages
6h 26m
English
We need to call initializePeer() from within two signaling callbacks, handleScConnectedPeer() and handleScConnectedPeers(), that fire in response to peer-connection events. Both callbacks must now process data payloads containing peer IDs from the signaling channel.
Let’s start with handleScConnectedPeer(), which works with a single incoming ID. It should initialize a peer for that ID and establish the call features, too:
| | function handleScConnectedPeer(id) { |
| | console.log(`Newly connected peer ID: ${id}`); |
| » | // be impolite with each newly connecting peer |
| » | initializePeer(id, false); |
| » | establishCallFeatures(id); |
| | } |
You might recall that handleScConnectedPeer()
Read now
Unlock full access