Wireless • Last Updated 5/10/2024

Complete guide to WebRTC and how it works

WebRTC is both a powerful and exciting new technology that is powering person to person communication.

By Brian Segal

Video chat over WebRTC

WebRTC is a technology that was developed by Ericsson and Google, based on the JavaScript and C++ programming languages. Most people know, to some extent, that WebRTC is for internet communication. However, the finer details of what WebRTC actually is are less common knowledge.

So what is WebRTC, from a more detailed and functional standpoint?

What is WebRTC?

WebRTC (Web Real Time Communications) is an open source communication technology for mobile and desktop platforms. The technology is built on APIs that require no plugins, and, since the first stable release in 2018, WebRTC has gathered support from all major web browsers and operating systems.

WebRTC is built on several standards and protocols. It’s capable enough to be used for many purposes. But WebRTC is typically employed in real-time audio and video communications. It’s common for apps that use WebRTC to be browser-based. However, there are standalone apps like Facebook Messenger and Whatsapp that use WebRTC.

The thing that makes WebRTC unique is that it enables person-to-person communication. This means that WebRTC handles all the details of directly connecting two devices and transmitting the audio and video data in real-time. This might seem simple, given the ubiquity of phone calls and video chat. But it’s more complex than many people give it credit for.

We’ll cover how it works shortly. However, the real-time communication capabilities make WebRTC an ideal technology for just about anything that requires real-time conversation.

→ Looking to cut to the chase? With Telnyx, you can use WebRTC to call any phone number, anywhere in the world, from your web browser. Sign up for an account and start your free trial today.

What it’s Used for

WebRTC enables real time media communication in browsers and standalone apps. WebRTC enables developers to embed voice and video communications directly into web pages, without requiring the end user to install any browser plugins. The WebRTC API suite also enables developers to use WebRTC in real-time communications apps.

Most people may think that WebRTC isn't suitable for making true landline phone calls. With Telnyx, it is. Our WebRTC SDKs allow you to place a call to any phone number, anywhere in the world, from your browser. Sign up and start your free trial today!

How does WebRTC Work?

Generally speaking, a WebRTC connection goes like this:

Your device > STUN server > Peer-to-peer communication channel > Recipient’s device

However, there are processes involved at each step. Here’s how it works:

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.

Before a WebRTC connection can be established, the WebRTC app must navigate through your firewall and NAT. Firewalls and NAT devices work by establishing a public facing IP address for your computer, which is broadcast to the outside world and masks your private IP address.

Your computer only knows your private IP address. So the WebRTC app contacts the STUN (Session Traversal Utilities for NAT) server to retrieve your public facing IP address. That way the WebRTC app can route the incoming connection to the right 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.

→ Getting confused? Our experts can help you build WebRTC apps with ease.

The WebRTC app then uses that connection configuration to open a private data channel where all the devices on the WebRTC call can exchange the audio and video data in real time. And since only the devices on the call know the connection configuration, the connection is private and can’t be accessed by anyone who’s not on the call.

This is the usual connection method for WebRTC communication, where all of the devices on the WebRTC transmit the audio and video streams directly to one another. However, this direct connection sometimes can’t be established.

In these cases, the WebRTC app uses a TURN (Traversal Using Relays Around NAT) server. The turn server simply acts as a repeater. If a direct connection cannot be established between the device on a WebRTC call, the app will have the computers send audio and video data to the TURN server, which transmits the data to the receiving device and vise versa.

However, using a TURN server for WebRTC communication is a last resort. TURN servers must be super reliable and have considerable processing power and bandwidth. This is costly and adds complexity. So it’s most efficient to use direct connections for WebRTC communication whenever possible.

This is a very high level overview of how WebRTC works. There are also supporting technologies and APIs involved in this process. Generally the supporting technologies are used to navigate the complex system of ports, protocols, and networks between the devices on a WebRTC call, while APIs are used to access cameras and microphones and gather the audio and visual data.

The Pros and Cons of WebRTC

WebRTC is a cutting edge technology. While that means that it brings a lot of great new capabilities to the table, it also presents certain complications. As with any new technology, there are wrinkles that still need to be worked out.

Benefits of WebRTC

WebRTC was created to give developers a simpler way to achieve high quality real-time communication. But WebRTC is also simpler for the end user, which makes for a more pleasant user experience.

  • Better Sound Quality

    WebRTC offers built-in support for echo cancellation and noise reduction, as well as automatic microphone sensitivity adjustment. This alone makes WebRTC calls clearer than other connection technologies. However, WebRTC also uses modern audio and video codecs to deliver outstanding call quality, even on slow connections.

    → Learn how Telnyx WebRTC leverages our purpose-built IP communications network to provide crystal-clear sound quality.

  • Open source technology

    Open source code gets quickly evaluated and quality controlled by the WebRTC community. But the open source code has also led to widespread adoption.

    → Check out our open source WebRTC demo app on GitHub.

  • Simplified development

    Even though WebRTC is based on C++ architecture, WebRTC has a built-in Javascript API layer, which developers can use to quickly implement WebRTC solutions with relatively little proprietary code.

    Build your own WebRTC calling application in less than an hour with our Quickstart guide!

  • Secure and stable

    WebRTC is protected by a few mandatory encryption specifications. This provides end-to-end encryption for any data sent through a WebRTC peer-to-peer connection.

    Talk to our experts about how Telnyx secures your WebRTC communications.

  • Outstanding compatibility

    Thanks to the open source code, WebRTC is supported by all the major desktop and mobile operating systems. WebRTC also works in any HTML5 or WebSocket interface. So WebRTC works in almost any browser.

    → See for yourself! Follow our Quickstart guide and start making calls from your browser in less than an hour.

  • Requires no plugins

    Most real-time communication technologies require a plugin to make calls using a browser. These plugins must be installed by the end user, which degrades the end user experience. Most browsers support WebRTC without any plugins.

→ See for yourself! Follow our Quickstart guide and start making calls from your browser - no need to install any browser plugins!

Drawbacks of WebRTC

Although WebRTC is an outstanding real-time communication solution, it’s not quite perfect:

  • WebRTC is a developing technology

    WebRTC is a new technology and the current version is a working draft. That means that the WebRTC source code could undergo significant changes in the future. Whether or not future versions will be backward compatible with previous versions remains to be seen.

→ Keep on top of the newest developments in WebRTC - join our developers' Slack community.

  • Conference calling is resource intensive

    Web browsers cannot synchronize multiple incoming audio and video streams. This means that conference calls require a conferencing server to mix the audio and video streams before distributing them as a unified data stream. Building a conferencing server is a large infrastructure investment, and most companies end up paying for an IaaS cloud solution to provide conferencing servers for WebRTC group calls.

    Chat to an expert and learn how the Telnyx network can handle all of your WebRTC conferencing needs.

Do You Need WebRTC?

Short answer: yes, you need WebRTC. Most people have a browser that supports WebRTC. And WebRTC works without any plugins or browser extensions. From an end user perspective, WebRTC is click to play. It’s the simplest possible end user experience.

WebRTC is also simpler on the backend. You can dig into the C++ source code if you want. But you can also just use the JavaScript APIs to simplify production and shorten development cycles.

All that adds up to more adoptable software, since a more pleasant user experience means more users for your software. And easier development means a better life for your development team and better shipped software.

If you're building communications for your employees (in call centers, sales pens, offices, or anywhere else), you might be getting nauseous at the cost of provisioning softphone clients—or, worse still, physical desk phones—for your employees. WebRTC is the answer. Why bother spending money on provisioning when you can turn your employees' web browsers into fully-fledged phones using WebRTC with Telnyx?

Use Cases for WebRTC

The uses for peer-to-peer communication might seem pretty straightforward. But WebRTC is a flexible technology that’s easy to integrate into any software. You can actually do a lot more with WebRTC applications than you might think.

  • Online education

    The online education industry is expected to top $370 billion by 2026. And it’s not just traditional schools and higher education institutions. Learning platforms like Skillshare, Sololearn, Stackskills, and MasterClass also deliver thousands of courses.

    No matter what sort of online learning you deliver, WebRTC gives your platform the ability for students and instructors to interact, in real-time, with just the browser they’re already using.

    Chat to our experts about how Telnyx WebRTC empowers remote learning.

  • Telemedicine

    Telemedicine is increasingly being adopted as a way to provide more affordable and accessible healthcare around the world. WebRTC offers a simple and efficient way to facilitate face-to-face conversations between patients and their healthcare providers.

    → Learn how Telnyx empowers healthcare communications across channels, including WebRTC.

  • Team communication and collaboration solutions

    Remote work is becoming the new way of getting things done. Over a quarter of the American workforce is now working remotely. That’s generated a huge demand for tools that help teams collaborate and communicate.

    As you probably know, there are already some key players in this market. But the rise in remote work has presented opportunities to solve the unique problems of industries that have been slow to adopt remote working. And WebRTC is the best way to build low-overhead solutions to modern communication struggles.

    → Building your own voice or video communications tooling? We can help.

  • Gaming and entertainment

    Computer and console gaming is more interactive than ever. Single player games are almost non-existent in today’s gaming market. And browser-based gaming is quickly catching on. That means that there’s more demand for real-time communication in gaming and more games will be played in browsers. WebRTC is a slam dunk for the future of gaming.

  • One-way conversational devices

    One-way conversational devices like Alexa and Google Nest already use WebRTC. And the market for one-way conversational devices and voice-activated smart devices is expanding rapidly. Even though WebRTC is intended to be a two-way communication technology, it’s also lightweight enough to work in a one-way conversational device without any dead weight.

    Ultimately, WebRTC works for just about anything that requires real-time communication, even if that communication is only one way.

    Talk to our team about integrating WebRTC with Wireless IoT.

WebRTC Alternatives

There are very few true WebRTC alternatives. However, there’s a lot of misunderstanding around what would be a true WebRTC alternative. Some compare services like Skype to WebRTC. But that’s not a good comparison. Comparing WebRTC to Skype is like comparing apples to fertilizer.

WebRTC is an underlying technology that services like Skype are built on. Skype doesn’t use WebRTC. But one could build a service just like Skype using WebRTC as the foundational tech. But WebRTC alternatives do exist.

  • Red5

    Red5 is a real-time streaming technology. It’s not specifically built for two-way communication. But it’s designed to send audio and data streams in real time. So it can be used for communication solutions.

    However, Red5 is not completely free. And it’s not as lightweight as WebRTC.

    Already have FreeSWITCH SIP infrastructure set up? Follow our simple configuration guide to connect it to Telnyx SIP trunks.

  • FreeSWITCH

    FreeSWITCH is designed specifically for two-way communication, with an emphasis on hardware control. Although FreeSWITCH has good telecom capabilities, it’s not as software compatible as WebRTC. FreeSWITCH works best for creating communication devices from common hardware like Raspberry PIs. Whereas WebRTC is more efficient for creating software solutions.

→ Already have FreeSWITCH SIP infrastructure set up? Follow our simple configuration guide to connect it to Telnyx SIP trunks.

Although these technologies are viable WebRTC alternatives, and they’re very capable in certain applications, they’re nowhere near as flexible and lightweight as WebRTC. The reality is that there’s no direct competition to WebRTC when it comes to delivering browser-based communication.

Get Started with WebRTC

If you’re building any sort of real-time communication solution, WebRTC is the way to go. It’s simple for developers, simple for end users, and there’s nothing else that does what WebRTC does as well as WebRTC does it.

And since WebRTC just works, build your solution on a network that just works, and get SIP trunking that’s as simple and easy to use as WebRTC itself.

Talk to a WebRTC expert or sign up and start building today.

Share on Social

Related articles

Sign up and start building.