This article introduces the protocols on top of which the WebRTC API is built.
ICE
Interactive Connectivity Establishment (ICE) is a framework to allow your web browser to connect with peers. There are many reasons why a straight up connection from Peer A to Peer B won't work. It needs to bypass firewalls that would prevent opening connections, give you a unique address if like most situations your device doesn't have a public IP address, and relay data through a server if your router doesn't allow you to directly connect with peers. ICE uses STUN and/or TURN servers to accomplish this, as described below.
STUN
Session Traversal Utilities for NAT (STUN) is a protocol to discover your public address and determine any restrictions in your router that would prevent a direct connection with a peer.
The client will send a request to a STUN server on the Internet who will reply with the client's public address and whether or not the client is accessible behind the router's NAT.
NAT
Network Address Translation (NAT) is used to give your device a public IP address. A router will have a public IP address and every device connected to the router will have a private IP address. Requests will be translated from the device's private IP to the router's public IP with a unique port. That way you don't need a unique public IP for each device but can still be discovered on the Internet.
Some routers will have restrictions on who can connect to devices on the network. This can mean that even though we have the public IP address found by the STUN server, not anyone can create a connection. In this situation we need to use TURN.
TURN
Some routers using NAT employ a restriction called 'Symmetric NAT'. This means the router will only accept connections from peers you've previously connected to.
Traversal Using Relays around NAT (TURN) is meant to bypass the Symmetric NAT restriction by opening a connection with a TURN server and relaying all information through that server. You would create a connection with a TURN server and tell all peers to send packets to the server which will then be forwarded to you. This obviously comes with some overhead so it is only used if there are no other alternatives.
SDP
Session Description Protocol (SDP) is a standard for describing the multimedia content of the connection such as resolution, formats, codecs, encryption, etc. so that both peers can understand each other once the data is transferring. This is, in essence, the metadata describing the content and not the media content itself.
Technically, then, SDP is not truly a protocol, but a data format used to describe connection that shares media between devices.
Documenting SDP is well outside the scope of this documentation; however, there are a few things worth noting here.
Structure
SDP consists of one or more lines of UTF-8 text, each beginning with a one-character type, followed by an equals sign ("="
), followed by structured text comprising a value or description, whose format depends on the type. The lines of text that begin with a given letter are generally referred to as "letter-lines". For example, lines providing media descriptions have the type "m"
, so those lines are referred to as "m-lines."
For more information
To learn more about SDP, see the following useful resources:
FAQs
WebRTC provides software developers with application programming interfaces (APIs) written in JavaScript. Developers use these APIs to create peer-to-peer (P2P) communications between internet web browsers and mobile applications without worrying about compatibility and support for audio-, video- or text-based content.
What are WebRTC protocols? ›
Web Real-Time Communications (WebRTC) is an open-source communications protocol that enables real-time voice, text, and video streaming between web browsers and devices.
Does WebRTC use TCP or UDP? ›
WebRTC primarily works over UDP, while WebSocket is over TCP. This means that WebRTC offers slightly lower latency than WebSockets, as UDP is faster than TCP. However, the difference is negligible; plus, TCP is more reliable when it comes to packet delivery (in comparison, with UDP some packets may be lost).
What is the WebRTC introduction? ›
What Is WebRTC? WebRTC or Web Real-Time Communication was created to act as a standard for enabling real-time communication between web browsers. It is an open-source project created by Google and is now developed by various large organisations such as Google, Mozilla, Opera, and more.
Does Netflix use WebRTC? ›
No, Netflix does not use WebRTC for streaming. They use their own proprietary technology called Adaptive Streaming over HTTP (ASoH) that is based on HTTP Live Streaming (HLS).
Is WebRTC owned by Google? ›
WebRTC is an open-source project supported by Google, Mozilla and Opera. The API and underlying protocols are being developed jointly at the W3C and IETF.
Is WebRTC still used? ›
WebRTC was originally created to facilitate peer-to-peer communication over the internet, especially for video and audio calls. It's now used for more use cases, including text-based chats, file sharing, and screen sharing. WebRTC is used by products like Microsoft Teams, Skype, Slack, and Google Meet.
What is the difference between WebRTC and HTTP? ›
HTTP-based protocols use Transmission Control Protocol (TCP), whereas WebRTC often uses Transmission Control Protocol (TCP). Both are the two fundamental protocols that reside on the transport layer. The primary difference between TCP and UDP is that TCP needs a three-way handshake to send data.
Does WebRTC require a server? ›
Even a standard browser-based peer-to-peer connection technically utilizes an application server, the same application servers on which browsers rely. Really, there's no way to truly use WebRTC without any server.
Is there any alternative to WebRTC? ›
Additionally, there are expenses related to infrastructure, hosting, maintenance, salaries for personnel, and other factors that contribute to an increase in the overall budget. The top 10 WebRTC Alternatives are VideoSDK, Twilio, MirrorFly, Agora, Jitsi, Vonage, AWS Chime, EnableX, WhereBy, and SignalWire.
WebSocket is a communication protocol for messages, while WebRTC is designed specifically for real-time video and audio communication. Is WebRTC built on WebSockets? No, WebRTC is not built on WebSockets; it uses its own protocols for real-time communication, though they can work together.
Which language is used in WebRTC? ›
WEBRTC is a plugin-free modern real-time communication technology. It doesn't require any additional plugins or applications for audio, video streaming and data sharing. It uses Javascript, application programming interfaces (APIs), and HTML5 to embed the communication technologies within the browser.
What protocol does WebRTC use? ›
Signaling: How peers find each other in WebRTC
Signaling uses an existing, plain-text protocol called SDP (Session Description Protocol). Each SDP message is made up of key/value pairs and contains a list of “media sections”.
What is the WebRTC API? ›
WebRTC (Web Real-Time Communication) is a technology that enables Web applications and sites to capture and optionally stream audio and/or video media, as well as to exchange arbitrary data between browsers without requiring an intermediary.
What are the disadvantages of WebRTC? ›
Disadvantages of WebRTC in Broadcasting
For example, it can be limited by the viewer's Internet connection speed, which can lead to a decrease in the quality of the broadcast. Additionally, WebRTC is not always suitable for streaming large events with high network load.
What is WebRTC vs Web Audio API? ›
A critical part of WebRTC is the transmission of audio. Web Audio API is all about processing and synthesizing audio in web applications. It allows developers to create complex audio processing and synthesis using a set of high-level JavaScript objects and functions.
Is WebRTC only P2P? ›
WebRTC uses the Peer-to-Peer Connection (P2P) protocol to communicate securely between two devices. P2P is a decentralized network protocol that doesn't rely on a central server. This makes it ideal for use in web applications where data needs to be exchanged between two or more devices in real time.
Is WebRTC a server? ›
A WebRTC server is a computer that handles some aspects of establishing peer-to-peer connections, transmitting data, and maintaining connection stability for real-time communication. There are four key WebRTC servers: Media servers. Signaling servers.