Google originally designed its Web Real Time Communication (WebRTC) protocol for purely browser-based communication. However, I believe WebRTC is becoming an important option as a communication protocol for IoT devices as well.
Whether it’s smart home devices responding instantly to user commands or health care devices immediately transmitting critical patient data, WebRTC is now allowing smart devices to transfer data more quickly and more securely. Here’s what you should know about the place WebRTC holds in IoT.
WebRTC is an open-source project that provides real-time communication capabilities for both web-based and mobile-based applications. The best part is, the protocol enables voice, video, and data transfer without the need for any specialized plugins or external software. So when you use Google Meet, for example, you don’t have to download an app; instead, you can just open up a link and immediately connect with another user from anywhere in the world.
WebRTC establishes direct peer-to-peer (P2P/NAT-traversal) connections, allowing data to flow directly between devices instead of through a separate server, which reduces latency and increases the overall efficiency of data transfers. The protocol also adapts to network conditions, which means it can actually change the quality of the audio and video to accommodate a slow network rather than just crashing the browser.
These are some of the most important components of WebRTC:
- MediaStream: Captures audio and video in real-time
- RTCPeerConnection: Facilitates audio and video communication between peers in a conversation, handling connection information and media control
- RTCDataChannel: Enables peer-to-peer exchange of various types of data
Let’s spend a little more time with each of those.
MediaStream interfaces directly with media hardware like webcams and microphones, allowing the devices to gather live audio and video feeds and transfer it via the browser. Again, you’ve likely seen this at work with browser-based video conferencing software like Google Meet.
RTCPeerConnection sets up the initial connection between peers: for example, between two participants in a video meeting. This component also handles the negotiation of media codecs, meaning how data is compressed or decompressed for transit, and various other aspects of the media stream, like when it starts and ends. Developers call this negotiation process “signaling.”
Finally, the RTCDataChannel component supports the transmission of binary data – like files or images – and text data. This can be particularly useful in applications that require additional data types alongside audio/video streams. WebRTC’s capability to transfer more than just audio or video makes it useful for general smart applications, like smart indoor environmental control systems, for example.
You can also transmit other IoT protocols over the data channel, including the Constrained Application Protocol (CoAP), a web transfer protocol that’s optimized for low-power IoT devices.
All of these components together make WebRTC particularly powerful. Still, it hasn’t always been a top option for IoT.
The Evolution of WebRTC for IoT
Back in 2011, Google released WebRTC to the open-source development world so that anyone could use it or play with the base code free of charge. While the protocol could transfer various types of data from the start, early versions focused primarily on browser-to-browser video and audio streaming applications. Since then, developers have added to the protocol and made it more versatile.
During the pandemic, WebRTC received increased attention with more people working from home and relying on browser-based technologies for everyday work and communication. As a result, the World Wide Web Consortium and the Internet Engineering Task Force worked together to fully standardize the protocol and ensure compatibility and interoperability across various platforms and browsers.
Today, WebRTC is fully compatible not only with browsers, but also with Android and iOS-native applications. Since the goal for many IoT developers and manufacturers is to enable users to control IoT devices like smart security systems or home smart devices through their smartphones, mobile capabilities have been one of the most important aspects of WebRTC for IoT.
WebRTC in the IoT Landscape
WebRTC for IoT helps solve some of the top challenges in smart device communication today.
Challenge #1: Latency
IoT devices don’t always send messages instantly. Sometimes, there’s a delay, called latency, and in safety-critical or security-critical environments, latency can be deadly. So the “real time” aspect of WebRTC helps ensure messages or instructions you send to or receive from IoT devices have the lowest latency possible.
Challenge #2: Security
Another significant challenge is security. In the first six months of 2023, attacks on IoT devices rose by over 35 percent over the previous year. While many IoT communication protocols require developers to add extra security measures or configuration, WebRTC has security built in with Secure Real-time Transport Protocol (SRTP) by default, which prevents any eavesdropping or tampering with data packets.
Challenge #3: Data formats
The next big challenge in IoT that WebRTC helps to solve is the complexity of managing data in the various formats that IoT devices require. To allow full control over IoT devices, we need communication protocols that can handle a lot of data at high speeds, protect information in transit, and work with data in a lot of different formats. WebRTC fulfills all of those requirements.
Challenge #4: Compatibility
Lastly, there’s the problem of compatibility in IoT. Smart devices from different manufacturers commonly follow different protocols and standards that make it hard for them to communicate with each other. Since WebRTC is platform-independent and compatible with all major browsers and systems, it provides a high level of interoperability between devices and IoT systems.
All in all, WebRTC may not have been an IoT protocol in its earliest iterations, but it is certainly shaping up to be an important option to help solve some of the IoT world’s biggest issues this coming year.
WebRTC IoT Use Cases
I’ve already discussed the use of WebRTC in video streaming in detail in another blog post, but it’s worthwhile mentioning here a few of the other top uses for WebRTC within IoT.
Firstly, WebRTC enhances smart security systems by enabling users to seamlessly view video surveillance footage from smart security cameras within their browser. The versatility of the protocol extends beyond video, supporting the transfer of various data formats with minimal latency. This opens up a wide range of possibilities, allowing users to receive real-time updates and enhancing the overall functionality of smart security systems.
Another application of WebRTC IoT that is gaining popularity is for health care applications. Remote health care is rising in popularity, and smart health care devices can collect patient health data for review by a physician. Of course, WebRTC is also ideal for video conferences between patients and their physicians.
In short, WebRTC is great for almost any IoT situation in which low latency is a priority or devices are dealing with a lot of different file formats.
WebRTC vs. Other IoT Communication Protocols
Of course, WebRTC isn’t the only communication protocol out there for IoT, and many of its advantages are also present in other protocols. Some other top options include the Message Queuing Telemetry Transport protocol, the Constrained Application Protocol, the Hypertext Transfer Protocol (HTTP), and the Advanced Message Queuing Protocol (AMQP). Note that you can also use CoAP in addition to WebRTC rather than instead of; again, the RTCDataChannel can be used as a vehicle for the transport of other protocols.
Here’s a brief overview of those protocols and how they compare to WebRTC:
|Ideal Use Cases
|Real-time communication, P2P, browser-based
|Low latency, direct connections, media streaming
|Some streaming quality loss with poor connections
|Video streaming, remote control, real-time sensor data
|Publish/subscribe, lightweight, broker-based
|Efficient for low-bandwidth, unreliable networks
|Dependency on a broker, limited security features
|Sensor data collection, remote monitoring, device management
|Very lightweight, low overhead, suitable for low-power devices
|Limited reliability, less mature ecosystem
|Smart energy, building automation, sensor networks
|Publish/subscribe, enterprise-grade, reliable
|Feature-rich, high security, interoperability
|High overhead for constrained devices, complexity
|Financial transactions, logistics, healthcare
|Widely adopted, easy integration, web-friendly
|High overhead, not optimized for IoT
|Web-based applications, device management, firmware updates
For more information on these various protocols and how they compare, take a look at our recent comparison of IoT protocols.
WebRTC in IoT will only become more common throughout the coming years as the IoT industry begins to take more notice of its benefits and advantages among communication protocols. That’s why we are adding WebRTC compatibility to Nabto Edge for enhanced P2P connectivity.
To learn how Nabto’s upcoming WebRTC option will bring all the benefits of low latency and secure connectivity to IoT devices, contact us and request a consultation.
Read our other resources
We’ve also published a range of IoT device resources for our community, including:
- Our P2P explainer, which lays out the many benefits of P2P communication for IoT
- Why Use P2P for IoT Video Streaming?, a guide to why P2P is often the best option for IoT video applications
- What is WebRTC in Video Streaming?, which gives a more in-depth look at how exactly WebRTC functions and why it’s ideal for video surveillance and video conferencing