The DataChannel is often a second-class citizen of the WebRTC eco-system. WebRTC is increasingly well known because of the ability to easily get access to the camera and microphone from a user’s laptop, using only javascript.
This video and audio combination, combined with the Peer to Peer (P2P) architecture of WebRTC, has opened up many applications involving secure video chat. Telehealth apps, video conferencing in the browser, collaboration tools, telepresence solutions, and more … all of them are interesting applications based on WebRTC video chat.
Those of us building WebRTC apps all the time certainly enjoy the creative ways that video and audio can be used in the browser, but I also yearn to see more Data Channel related applications. When the Data Channel is used, it’s often as a secondary feature, something that is second class the main video chat functionality of the app.
On May 12th 2016, I hosted the RealTimeWeekly Show, and our guest discussed an interesting use of the WebRTC Data Channel. Dennis Mårtensson, CTO and co-founder of Greta.io, is our guest to discuss how the Data Channel is used for Content Delivery Networks, and what he’s learned working with the Data Channel for the last couple of years. I’ve linked to the video below, and if you want to know about future RealTimeWeekly Shows, check out RealTimeWeekly for free!
Most common use cases for the WebRTC Data Channel
#1 Text chat
You’re already using WebRTC for secure, encrypted, P2P video chat, so why not also use it for the text chat boxes that typically go along with video chat apps?
#2 File Transfer
By breaking up your file into small bits, you can send it across the Data Channel and re-assemble it on the other side for the receiving user(s). This is a secure solution for transfering medical files in a telehealth application for example.
Additional use cases for the WebRTC Data Channel
#3 Gaming
This is often given as an example of using the Data Channel for localized data in a massive multiplayer online game. Why bog down a centralized WebSockets server with position and command data that only gamers in a certain room care about? The DataChannel could be used over an RTCPeerConnection containing only gamers in a certain local area. That channel exchanges information only of interest to those in the area, like where you are looking or aiming a weapon. Keeping that data on the DataChannel reduces load on the central gaming server and may also reduce latency between local players. For more information, see my blog post on the Data Channel at WebRTC Hacks.
#4 IoT/Streaming Data
Perhaps you have some sort of streaming or real time data that you want to share on a dashboard. That data could be complementary to the video chat going on, or it might be completely independent of any use of the video/audio channels of WebRTC. The Data Channel could be a good solution for this, especially if you prefer the data is exchanged directly between peers, and not through a central server. For example, there is a variant on “cloud computing” called “fog computing“. In fog computing, imagine that you have lots of IoT devices that need to share data with each other, but that data is never sent up to a central server. Those devices make up a fog of computers with no central point, and they could be talking to each other over the WebRTC Data Channel. I did a talk at WebRTC Boston about the IoT and WebRTC that talks more about this.
#5 The Data Channel and Content Delivery Networks
One additional use case of the Data Channel is what I’ll be talking about with Dennis Mårtensson of Greta.io on May 12th 2016. Greta is a Content Delivery Network that uses the WebRTC Data Channel to share data between site visitors who are geographically close to each other.
A Content Delivery Network allows static resources on your site to be served up from other servers, reducing the load on your site. Instead of a traditional CDN however, the WebRTC Data Channel allows you to do some Peer to Peer file exchange directly between visitors to your site.
If you want to learn more about the use of WebRTC for Peer to Peer file exchange in a Content Delivery Network scenario, check out our discussion with Greta.io CTO Dennis Mårtensson:
What other use cases can you imagine?
Do you have other ideas for the WebRTC Data Channel, or do you know of some other interesting uses cases and blog posts about it? Feel free to share them in the comments section below!