Building Connection Logic to the “Perfect Negotiation” Pattern

We’re going to build the connection’s receiving logic according to the “perfect negotiation” pattern described in the WebRTC specification:

This pattern has advantages over one side always being the offerer, as it lets applications operate on both peer connection objects simultaneously without risk of glare (an offer coming in outside of “stable” state). The rest of the application may use any and all modification methods and attributes without worrying about signaling state races.[25]

That’s a dense quotation, but here’s the essence: in symmetric WebRTC apps like the one you’re building, both sides of the connection can pass an offer to the other. That’s essential because it’s ...

Get Programming WebRTC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.