WebRTC Protocol: What Is It And How Does It Work?
Tags: webrtc, videostreaming, saas
Published: 2022-11-07 16:17:17

WebRTC is a highly flexible streaming protocol suitable for nearly every audio/video use case. While this characteristic and its media encryption capabilities make it a popular choice among broadcasters, this protocol does have three major drawbacks potential streamers should be aware of. Read on to learn what they are, how much they might impact your stream, and learn if WebRTC is right for your project.

What Is WebRTC?
---------------

[Web Real-Time Communications](https://webrtc.org/) (WebRTC) is an open-source [communications protocol](https://getstream.io/blog/communication-protocols/) that enables real-time voice, text, and video streaming between web browsers and devices. With the help of signaling servers, WebRTC is able to manage multiple device connections and ensure their integrity.

WebRTC provides software developers with [application programming interfaces](https://getstream.io/glossary/application-programming-interface-api/) (APIs) written in JavaScript. Developers can leverage APIs to create a [peer-to-peer conferencing](https://getstream.io/blog/peer-to-peer-video-conferencing/) (P2P) connection between internet web browsers and mobile applications without worrying about compatibility and support for multimedia content.

Data transfers occur in real-time without needing custom interfaces, extra plugins, or additional software -- WebRTC enables real-time audio and video streaming simply by opening a webpage. However, to access more advanced features like screen sharing, you can either install a [plug-in](https://chrome.google.com/webstore/detail/webrtc-desktop-sharing/nkemblooioekjnpfekmjhpgkackcajhg?hl=en) or [build your own](https://www.metered.ca/blog/webrtc-screen-sharing/).  

How Does WebRTC Work?
---------------------

WebRTC embeds real-time communications technologies within web browsers using JavaScript, APIs, and [Hypertext Markup Language](https://developer.mozilla.org/en-US/docs/Web/HTML). It makes audio, data, and video streaming between most major web browsers user-friendly and easy to implement. Before audio and video files are sent, they must be compressed due to their large size. Also, media received over a peer-to-peer (P2P) connection must be decompressed. WebRTC uses a codec process to do this.

WebRTC typically connects users by transferring real-time audio, video streams, and data from device to device using P2P. But, if users are on different Internet Protocol (IP) networks with [Network Address Translation](https://www.comptia.org/content/guides/what-is-network-address-translation#:~:text=NAT%20stands%20for%20network%20address,as%20do%20most%20home%20routers.) (NAT) firewalls that prevent real-time communication (RTC), [Session Traversal Utilities for NAT](https://help.hcltechsw.com/sametime/11.6/admin/session_traversal_utilities.html#:~:text=What%20is%20STUN%3F,messaging%2C%20and%20other%20interactive%20communications.) (STUN) servers can be used to translate an IP address into a public internet address, so P2P connections can be established. WebRTC APIs initiate and monitor P2P connections between devices via browsers and facilitate bidirectional data transfer over multiple channels.

Why Choose WebRTC? 
-------------------

WebRTC has a wide range of benefits for both the broadcaster and the receiving audience. Here are the top three: 

1.  WebRTC eliminates much of the in-house manual integration work required of IT teams by adjusting communication quality, bandwidth, and traffic flow whenever network conditions change.
2.  WebRTC is supported by most major web browsers, including Google Chrome for desktop and Android, Mozilla Firefox for desktop and Android, and Safari, and works on any operating system.
3.  WebRTC does not require third-party components or plugins and is free open-source software.

When To Use WebRTC
------------------

Use WebRTC to facilitate real-time communications over the internet for a number of use cases: 

-   Businesses can host [video chats](https://getstream.io/blog/build-video-chat-app/) and meetings on video calling platforms, such as Zoom, Microsoft Teams, Slack, or Google Meet.
-   [Telehealth](https://getstream.io/chat/solutions/telemedicine/) organizations can connect patients and providers securely over a web browser for virtual appointments.
-   Home and business surveillance companies can use WebRTC as a connecting agent between browsers and security cameras.
-   Sporting, news, and other [live events](https://getstream.io/chat/solutions/virtual-events/) can use WebRTC to deliver a high-quality stream in real time.
-   Students and teachers can facilitate[ remote learning](https://getstream.io/chat/solutions/ed-tech/) over WebRTC.

When Not To Use WebRTC
----------------------

While WebRTC is encrypted and its APIs require secure origins via [Hypertext Transfer Protocol Secure ](https://www.cloudflare.com/learning/ssl/what-is-https/)(HTTPS), there are still some concerns around security questions developers must consider. There are no signaling processing methods specified for WebRTC signaling. If you do not wish to decide which security protocols to use and are unsure if the protocols you select can be maintained with WebRTC, you might consider looking into an alternative [video streaming protocol](https://getstream.io/blog/streaming-protocols/).

While security is a top concern among many potential WebRTC users, here are three other aspects of the protocol worth considering where they fall on your list of development priorities:

1.  Bandwidth: Each user must establish a P2P browser connection, making bandwidth an issue.
2.  Cost: Maintenance costs can be high because WebRTC requires powerful servers.
3.  Service Standards: There is no definitive quality of service standards, which means that the quality of video or audio over the internet may be inconsistent.

Frequently Asked Questions
--------------------------

1\. Does Zoom use WebRTC?

No, Zoom uses a custom protocol solution with levels of fallback in the event their custom protocol is unavailable.

2\. Is WebRTC owned by Google?

Any one company does not exclusively own WebRTC. Google developed WebRTC and has worked with W3C, Mozilla, and Ericsson Labs to continue to iterate and improve the protocol. 

3\. Is WebRTC only for browsers?

Yes, WebRTC is available to all modern browsers and will not work on mobile iOS apps out of the box. 

4\. Does WebRTC need a server?

Yes, WebRTC requires a signaling server for devices that wish to communicate to locate one another. 

5\. What is the difference between Websocket and WebRTC?

WebRTC is intended to facilitate real-time communication, mostly voice and video, over browsers, while Websockets are intended to help browsers and web servers communicate.

6\. Can I use WebRTC for live streaming?

Yes, WebRTC is a popular choice for live streaming because it is a free, open-source protocol compatible with all major browsers and requires little additional engineering. 

7\. Is WebRTC a TCP or UDP?

WebRTC is a unique browser protocol because it transmits its data over UDP instead of TCP, like most others. 

8\. What is WebRTC network limiter?

WebRTC offers a network limiter extension for most browsers that enables the user to decide how the WebRTC network traffic is routed. It can also make private IP addresses invisible to the public internet.

9\. What is a WebRTC gateway?

A WebRTC gateway bridges the Web and traditional telecom worlds, providing signaling interworking, media interworking and transcoding, and application interworking functions. The WebRTC gateway can be a turn-key appliance or a software-based solution that runs industry-standard servers.

10\. What is a data channel?

A data channel is the path transmitted data takes when transferred from one device to another.

Know that you know what WebRTC is and how it works, bookmark this repository of [WebRTC tutorials and resources](https://getstream.io/blog/webrtc-tutorials/) to refer back to if you have any questions or want to brush up on a particular facet of the protocol.