Hello there, everyone!!
How is it going?
Welcome to scaleyourapp.com
We have been downloading files using torrents in desktop-based applications like BitTorrent. But we don’t have much of an acquaintance with cloud web-based torrents.
What are they? What is the need for web torrents? Can we transfer data directly from website to website in a browser without an intervention of an intermediary server?
This write-up is a comprehensive discussion into understanding web torrents. How they work & everything.
So, without any further ado. Let’s get on with it.
1. What is Web Torrent?
Web torrent is a torrent client which works in the browser, as opposed to BitTorrent or uTorrent which work as an installable desktop application. Web Torrent connects websites with each other forming a massive decentralized browser to browser torrent-based network for smooth data transfer.
Web Torrent uses WebRTC (Web Real-Time Communication) as an underlying tech to facilitate peer to peer communication. Once the peers are in communication, the data transfer process is similar to that of in BitTorrent.
There is no requirement of installing any browser extension or plugin or anything of that sort. Just the browser supporting WebRTC will suffice to use Web Torrent. Today, primarily all popular browsers support WebRTC.
So, using Web Torrent with them doesn’t bring up any hassle. Besides being on the web, Web Torrent has a desktop client too.
It is important to know that web torrent can only connect to clients on the web which support Web RTC. Web RTC support is required.
Alright, I get it. But what is Web RTC exactly?
1.1 What is Web RTC?
Web RTC is an open source tech which enables browsers & mobile apps process real-time data like audio video streaming, chats etc. Web RTC offers a simple API via which P2P applications can process real time data however they like. This tech averts any need for any kind of browser extensions & plugins for handling data. It also cancels out the need for all the intermediaries in between the web apps for the exchange of data.
Well, this was the gist of what Web RTC is.
If you are a little hazy on the underlying architecture of a peer to peer network, p2p web apps etc. I’ll suggest, go through the articles I’ve written in depth about them. Here they are.
Now, let’s go through some of the out of the box features offered by Web Torrent
2. What are the Features Offered by Web Torrent?
Web Torrent is a torrent client for NodeJS & the web which facilitates streaming of data across the websites. It provides a Torrent API for the respective environments.
2.1 Faster Streaming of Data
Web Torrent is faster in terms of data streaming when compared with traditional centralized servers for one simple reason data proximity. I’ll explain.
In case of peer to peer communication, the data sits on our local machines instead of a data center managed by a corporate entity. The network is more user driven as opposed to being corporate driven.
So, when a user requests a file sitting in a particular geographical location. Let’s say Japan. With Web Torrent, on request, he would start downloading the requested data from the machine hosting the data nearest to his geographical location. There is a possibility he might find the data on a machine in his same city.
In case of centralized networks held by corporates. When a user requests a data, the will download the data from their nearest data centers or CDN servers. If their data center is not setup in Japan by any chance. The data might move all the way to the user from across the continents. And that adds to the latency.
Now we are clear why data via Web RTC is faster.
2.3 Data can be downloaded from multiple machines simultaneously
A web torrent client can connect to multiple domains at the same time & download several files. If you look at this architecturally, several machines might host the same resource.
So, a web torrent client can download chunks of data of the same resource from multiple machines. There is less load on individual servers unlike centralized servers.
They are distributed but again there is a limit to it. In a p2p architecture, there is no limit of scalability. More machines become a part of the network, more the network scales.
Web torrent uses the rarest fetch algorithm when downloading files. The content which is seeded least is downloaded first. We can also tweak the algorithm as per our whim & requirements. We can prioritize & de-prioritize downloading of certain content, suiting our interest, with the torrent API.
Also, if you’ve worked in web development you might be aware of CORS cross origin resource policy. This policy restricts a particular web page to download content from several different domains. You can think of different domains as different servers on the backend.
CORS doesn’t apply to web torrent since there is no client & servers. Websites can connect with each other, with different domains & can share data with each other without any hassle.
Let’s dig a little deeper into web-based torrents.
3. Why use Web Torrent?
Let’s have a look at an application using Web Torrent Bitchute.
It’s a peer to peer video streaming service, running on a decentralized peer to peer network. There is no policing of any kind by a single corporate entity. More users with a wide view of ideas get to be a part of the network. There are no geographical boundations of any sort on the network.
Even if several machines, say in one continent go down. The network is still up. There is no centralized control, so network will split up into several mini-networks. Read about federated architecture, if you are intrigued about how things work.
Data streaming is really fast. No rubbing of unnecessary rules in our faces. They don’t decide what we watch.
We can also help non-profit organizations reduce their server load by chipping in.
Think about this, say you want to share your private data with your friend who lives on the other side of the planet. The file size is pretty large say 5 GB. How do you intend to share it with him?
A centralized third-party cloud drive?
Well, that’s good, but the risk is eavesdropping on your data when you upload your files on their server. They have the entire control over it.
With a web torrent based p2p file sharing app, you can share your data privately with your friend. Just create a private link of your data & share it with a friend of yours you intend to share with.
Cool isn’t it?
4. Is Live Streaming Possible with Web Torrent?
Torrents are immutable. Once created they have a fixed hash value & on changing the content the hash value changes. This results into a limitation with Web Torrent. Since data is immutable it cannot be live streamed with Web Torrent.
Though it’s not impossible to build a custom Live streaming solution on top of Web Torrent. If the idea excites you, you can get your hands dirty with it. ?
5. Applications Using Web Torrent
Let’s go through some of the real-world applications using web torrent.
BugOut lets you create & run servers from your browser tab; Sounds awesome. With this, we can run web services from our browser without the need for any VPN, domain or SSL certificate. I don’t know why I am smiling when writing this.
Alright, moving on to the next app.
LocalFiles lets users share files with each other via pinning them to the geographic locations.
Cinetimes lets you stream public domain movies peer to peer.
So, Guys!! This was just a glimpse of the cool stuff we can accomplish with Web Torrent.
More On the Blog
This was pretty much it. If you enjoyed the article. Do share it with your Geek friends.
I’ll see you in the next article.
- Distributed Systems, Scalability & System Design #1 – Heroku Client Rate Throttling
- Zero to Software/Application Architect – Learning Track
- Java Full Stack Developer – The Complete Roadmap – Part 2 – Let’s Talk
- Java Full Stack Developer – The Complete Roadmap – Part 1 – Let’s Talk
- Best Handpicked Resources To Learn Software Architecture, Distributed Systems & System Design