VoIP Resources VoIP Fundamentals WebRTC Essentials

RTCDataChannel - WebRTC Explained

by OnSIP

Learn about RTC DataChannel for WebRTC.

The three APIs that comprise WebRTC - getUserMedia, RTCDataChannel, and RTCPeerConnection - work in tandem to offer users unprecedented real-time communications capabilities in the browser itself. Of the three, RTCDataChannel is perhaps the least glamorous of the three. Here's an overview of getUserMedia. getUserMedia is responsible for capturing and transmitting real-time data from a computer’s webcam and microphone, and RTCPeerConnection is used to connect peers across the internet.

RTCDataChannel is responsible for the exchange of all real-time data that is not audiovisual. That means text-based chats (IMing), peer-to-peer file sharing, and other traditional forms of data that do not contain audiovisual. RTCDataChannel can be harnessed by the astute developer to build new and cost-effective solutions to some of the internet’s oldest problems.

Why RTCDataChannel?

There are certainly existing technologies on the internet that can offer mainstays like text chat and file sharing with relative ease, but there are a few considerations underneath the hood that make RTCDataChannel an appealing option for developers who want to incorporate traditional real-time data into their applications. The peer-to-peer nature of RTCDataChannel means that developers can bypass the prospect of having to maintain costly server-side equipment to facilitate data transfers. In fact, by using a free signaling platform like OnSIP's, developers can completely ignore the server-side complexities of crafting such an architecture to relay voice, video, or text in real-time. The resulting product also boasts lower latencies and higher security from decreased server hopping.

With technologies such as WebSocket, AJAX, and server-side events, some may see the option of another data channel as redundant. But RTCDataChannel offers a few key distinctions that separate it from the other choices. For one, it can be used with WebRTC’s RTCPeerConnection API to automatically enable peer-to-peer communication. This bypasses the need for an initiating server, which leads to lower latency. The delivery semantics of RTCDataChannel’s Stream Control Transmission Protocol (SCTP) allows for asynchronous delivery and retransmit configuration. This means data can arrive in the fastest possible fashion, rather than in a rigid, sequential order.

RTCDataChannel API - The Capabilities

One of the key features of RTCDataChannel is that it supports flexible data types. It was designed to imitate WebSocket’s bidirectional functionality, and it is built to support strings and well-known binary types such as Blob, ArrayBuffer, and ArrayBufferView. RTCDataChannel’s SCTP abilities give developers the ultimate leeway in deciding how data should be shared between two browsers. It allows for configurable reliability and delivery, message-oriented transmission, flow control, and congestion control. The protocol offers more flexibility than traditional mainstays such as TCP and UDP.

As with all WebRTC features, encryption is required of RTCDataChannel. In order to transmit any data, RTCDataChannel must secure the passing data with Datagram Transport Layer Security (DTLS). SSL is the parent model for DTLS, which means that WebRTC data will be secure via any standard SSL based connection. DTLS is a standardized protocol that is built into all browsers that support WebRTC. This means that data can be shared in a private, peer-to-peer fashion impervious to third party snooping.

RTCDataChannel and OnSIP

RTCDataChannel offers developers a speedy and secure way to transport data from browser to browser. Features that have often required additional software or complex server-side maintenance are now a thing of the past for developers who utilize WebRTC’s powerful APIs with signaling platforms such as OnSIP's. OnSIP has a mature SIP platform built to serve as a server-side signaling solution for developers who want to utilize WebRTC in their applications. OnSIP's platform allows developers to harness RTCDataChannel to build in-browser solutions to perennial old problems, such as real-time text chat and peer-to-peer file sharing. Although its audiovisual capabilities are often touted as revolutionary, WebRTC is still capable of doing what other applications already do, except in a faster, more secure, and very seamless fashion.

Learn more about VoIP Fundamentals