Real Time Communications Featured Article

WebRTC Can Decentralize the Internet One API at a Time

December 03, 2015

These days, anyone with a PC or smartphone will have the latest versions of Firefox, Chrome or Opera browsers which already have the ability to use the WebRTC protocol, a basic methodology for real-time communications over asynchronous links.

 In a blog posting in Programmable Web, guest author Tsahi Levent-Levi, a product manager at Amdocs, gives a brief summary of WebRTC.  He explains how a framework called PeerJS can be used to leverage the WebRTC data channel to accomplish things like anonymous peer-to-peer chats.

Levent-Levi explains that even a simple task like sending an email generally goes through several different servers in a link that requires using XHR (XMLHttpRequest), an API available to web browser scripting languages such as JavaScript. It is used to send HTTP or HTTPS requests to a web server and load the server response data back into the script, or WebSockets, a protocol providing full-duplex communication channels over a single TCP connection.

Of course, the main problem with this approach is that since a server is needed for every interaction, each step delays the process. A second problem is privacy, since each server knows everything. Levent-Levi believes that PeerJS, or simple peer-to-peer with WebRTC, can be a solution to these problems.

 PeerJS consists of two parts. The first is the client side script. This portion communicates with other clients using WebRTC. On the flip side, there is a Node.js server component, which keeps track of the connections between the clients.  

The server is aware of each client that is currently online so the clients can become aware of each other.  Once the clients know about each other, they can connect directly thanks to WebRTC’s RTCPeerConnection API. In turn, this allows sending arbitrary data between clients with an API very similar to the WebSocket API.

According to Levent-Levi, PeerJS is a simple, lightweight, easy-to-use service to interoperate between browsers, regardless of which browser is being used at either end. Another factor that makes it appealing to developers is that it open source and free.

There are already a few services that are using PeerJS, most notably Blippex, a search engine that follows users' search results. Another is Secretly Meet, a Facebook session without Facebook, neither of which relies on a server for the passing of private messages.

The question that this brings up is whether or not WebRTC will lead to the decentralization of the Internet one API at a time. There are already vendors that are looking at WebRTC’s data channel as a viable option, can we expect to see other channels change the way we use the Internet?

Edited by Kyle Piscioniere

Article comments powered by Disqus

  Subscribe here for RTCW eNews