WebRTC is an open-source communication technology for mobile and desktop platforms. It enables person-to-person communication by connecting two devices in real-time. Facebook Messenger and Whatsapp use WebRTC, which was released in 2018. The technology is built on APIs that require no plugins.
WebRTC enables real time media communication in browsers and standalone apps. The WebRTC API suite also enables developers to use it in real-time communications apps.
How does WebRTC Work?
WebRTC connection goes like this:
Your device > STUN server > Peer-to-peer communication channel > Recipient’s device
When you start a WebRTC audio or video call, your WebRTC app must establish a connection with all the other devices that will be connected on the call. The WebRTC app contacts the STUN (Session Traversal Utilities for NAT) server to retrieve your public facing IP address.
Once your public facing IP address has been retrieved from the STUN server, the WebRTC app retrieves the public facing IP for the other devices that will be connecting to the call. Once the app knows all the necessary IP addresses, it builds a list of potential connection configurations also called ICE (Interactive Connectivity Establishment) candidates and selects the most efficient configuration.
The WebRTC app uses a TURN (Traversal Using Relays Around NAT) server as a repeater when a direct connection can’t be established between devices on a call. If a connection cannot be established, the app opens up a private data channel where all the devices on the call can exchange audio and video data in real time. The API is used to access cameras and microphones and gather audio and visual data.