WebRTC explained

It's a web API to exchange real-time audio video streams entirely in the browser, allowing you to establish a peer-to-peer connection between two or more browsers where they can exchange video audio media directly without the need for third-party server or native app.

When a user requests a session between browser, it will send a session description protocol (SDP) which contain information describing the p2p connection the data will then be saved in a server where it can be read by another peer to answer the call by creating a session transfer protocol (STP)  answer then sending it to the server. This is called signaling and is handled by a third-party server.

Interactive Connectivity Establishment helps clients coordinate the discovery of their public ip addresses which list ice candidates which contain IP and ports, which peer 1 can connect to peer 2. In the background, webrtc will be making a series of requests to do session traversal utilities for nat (stun) server. Each peer will save their ice candidates in the database where they can be read by other peers, the algorithm will then automatically determine which candidate is best at which point real-time media can begin flowing between the two peers.

GitHub - fireship-io/webrtc-firebase-demo: Video Chat with WebRTC and Firebase
Video Chat with WebRTC and Firebase. Contribute to fireship-io/webrtc-firebase-demo development by creating an account on GitHub.

Subscribe to You Live What You Learn

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]