WebTorrent and my experience with it


This is a small blog about my understading from experience using WebTorrents platform to share media and files across. This is not a tutorial and I will point to the standard one.

What is WebTorrent?

WebTorrent is a torrent client written in Javascript and build on top of WebRTC protocol which brings torrents to the browser. What? Did you just say to the browser? Yes, that's right. First, lets see what torrents are in general and how we use them currently.

What is a torrent?

When we hear the word torrent we think of download movies, music, documents and games illegally. But, it is much more than that and its one of the best protocols out there.

BitTorrent is a peer-to-peer file sharing protocol, were we share files to & from people (peers) around the world in a decentralized way. As opposed to downloading files from a FTP server which sends out the same copy to everyone, we share it with each other.

How torrent works?

To understand how this happens, lets take the example of downloading an ISO file of any GNU/Linux distribution and see what happens,

Torrent creation

The torrent uploader creates the torrent file with the some metadata like,
  • Name of the file
  • How many pieces the torrent has
  • Cryptographic hash of the torrent file and those individual pieces
  • Tracker address and so on
  • Starts uploading it
  • The uploader can stop seeding after the complete file with at least one other peer

Torrent download

  • You download the torrent file or magnet uri from the website
  • You open it with your favorite torrent client program like Transmission, Deluge, uTorrent, Vuze, etc.,
  • The client reads the metadata from the torrent and contacts the trackers (computers that have details about what files are being shared and the peers that share them) to find out which peers (seeders) have the file you are downloading
  • Once the tracker gives the information, the client then directly contacts that peer and asks for piece(s) of the file
  • Once, the client software has all the pieces it reassembles them like a jigsaw puzzle to produce the original file
The beauty of torrents is that,
  • Its decentralized
  • No need to wait for the entire file to download, you can pause/resume whenever you like
  • Ease the bandwidth of the server and use it for other purpose
  • When there are more people sharing it the bandwidth is increased, because every new peer need not ask the same person for the file
  • It brings about the feeling of a community where people give and take what they need

WebRTC protocol

WebRTC is a Real Time Communication (RTC) by the W3C , which aims at enabling voice, video and p2p applications between browsers through simple API's. The highlight of this protocol is that everything is built into the browser and you don't need any specific plugins or softwares to be installed to use it.

Checkout the FAQ’s of WebRTC.

How WebTorrent is different from BitTorrent?

  • WebTorrent is built on top of WebRTC implementation that is aimed at having a true open and free p2p platform for applications like video/voice calling and file sharing
  • You do not need any special software or plugin to use it. Any WebRTC compliant browser with WebTorrent client would be enough (there is beta version of WebTorrent Desktop client software available here)
  • WebTorrent is much more similar to BitTorrent and differs only in the way peers connect and data transport
  • Apart from the above point, WebTorrent works the same as BitTorrent does
  • So, the existing BitTorrent client software could make a change to accommodate WebTorrent clients too
Checkout the FAQ's of WebTorrent.

Getting Started with WebTorrents

Checkout the official blog to get started with WebTorrent here.

Using WebTorrent

I used the follow the setup to test WebTorrent,
  • TP-Link WR841N router flashed with OpenWrt 15.05.1 and opentracker installed which is the torrent tracker
  • PC and Laptop running a GNU/Linux distro with WebTorrent-Desktop installed
  • I initially tried the following configurations,
    • Streaming between two WebTorrent-Desktop clients
    • Stream between BitTorrent client and WebTorrent-Desktop clients
  • Both configurations gave amazing results and helped me get a picture of what the concept is all about
Definitely looking forward to more from WebTorrent and WebRTC.



Rally really thanks for inspiring the new comers, who are yet “just users” of torrent. I believe this post will help them understand what torrent protocol is about. :wink: