Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could I build a bittorrent-like network with WebRTC?

Tags:

webrtc

I'm building an app that may take a bunch of bandwidth. Once a connection is established with a 3rd party, I'm curious if I can send data (not video or audio) losslessly from one client to another?

Technical challenges aside, would it be theoretically possible to set up a network like Bittorrent via WebRTC?

Does it require that the user give "permission" via one of those yellow bars at the top of the browser?

like image 819
RoccoB Avatar asked Oct 19 '25 13:10

RoccoB


1 Answers

Not only is it possible - it has been done.

For what you want to do, you will need to open a WebRTC data channel. This allows you to send any arbitrary data directly between the two browsers (assuming they can connect directly, otherwise, you will relay your data through a TURN server). The data sent can be marked as being lossy or lossless by the application, as well as ordered or un-ordered.

As for permission, today there is no user consent required. There have been some discussions around that (you can see here: https://bloggeek.me/webrtc-data-channels-explicitly-approved/)

If you are looking for an off-the-shelf implementation, check out https://webtorrent.io/

like image 84
Tsahi Levent-Levi Avatar answered Oct 22 '25 10:10

Tsahi Levent-Levi