transmission icon indicating copy to clipboard operation
transmission copied to clipboard

Support webrtc for webtorrent clients

Open uriva opened this issue 7 years ago • 48 comments

Hi, how difficult would it be to support clients connecting via webrtc?

Gitocin bounty details:

For all people who will be working on from Gitcoin required things is (the % is what you will be paid) :

Websocket tracker support [25%] Exchange file beetween nodes [70%] Use webtorrent if node is behind nat and can't use nat-pmp or upnp [5%] The port for webtorrent doesn't need to be the same than regular torrent, (cause webtorrent use ICE)

uriva avatar Sep 30 '16 18:09 uriva

No difficult at all. All you need to do is open a PR and commit to maintaining this part of Transmission for indefinite future ;)

mikedld avatar Feb 14 '17 09:02 mikedld

That's kind of a bitchy answer all we are doing is asking.

JacquesLG avatar Feb 14 '17 09:02 JacquesLG

I'm sorry but this is open source, the answer is clear even before the question is asked, so I didn't tell you anything new I suppose. If you want a differently-worded answer, here it is: it's not difficult, we'll do it when we'll do it, maybe earlier if someone (you?) is willing to help.

mikedld avatar Feb 14 '17 09:02 mikedld

Just thinking aloud here: This has the potential to really change how people use torrents drastically, if people can have torrents in-browser we can have an open source youtube in no time without commericals, which is super cool.

Whoever takes this on can change the web :)

uriva avatar Feb 22 '17 08:02 uriva

One way for the WebTorrent team to make this easier for Torrent client projects to support might be to spearhead the development of re-usable modules/ libraries that handle implementation of WebTorrent, which the client projects can then include somehow. There would need to be a module/ library project for each language/ framework combo used by major BT clients. To achieve maximum benefit, modules/ libraries would have to be under LGPL or some other license that allows them to be used with proprietary clients too.

strypey avatar Apr 29 '17 08:04 strypey

@feross to comment

uriva avatar May 02 '17 10:05 uriva

It would be difficult — WebRTC is a complex protocol, and as far as I know there are no easy to use WebRTC libraries.

You should contact the webtorrent people and ask them to implement WebSockets in addition to WebRTC. Adding support for BitTorrent over WebSockets would be much easier than WebRTC.

jech avatar Feb 10 '18 17:02 jech

I'm a mere user, struggling to understand the tech issues at play, but I believe WebSockets are used as well, as mentioned in this comment:

  1. You will have to connect to the websocket tracker in order to make WebRTC signalling. Basically you will have to add WebRTC offers on announce and manage SDP offers/responses. Here is our implementation: https://github.com/feross/bittorrent-tracker/blob/master/lib/client/websocket-tracker.js
  2. Once a WebRTC connexion is established, the torrent peer protocol is used, so there is nothing special here. This project uses https://github.com/feross/simple-peer to make the connexion then it becomes a "normal" peer. (Except that the connexion is handled upstream: https://github.com/feross/webtorrent/blob/15ed59a0d2c9d32598ab4c98706e6fd8fa200843/lib/peer.js#L16)

strypey avatar Feb 25 '18 16:02 strypey

I believe WebSockets are used as well

Only for tracker connections, not for data transfer.

jech avatar Mar 04 '18 18:03 jech

if people can have torrents in-browser we can have an open source youtube in no time without commericals, which is super cool

Slightly off-topic, but there is one now: https://github.com/Chocobozzz/PeerTube

progval avatar Jun 20 '18 23:06 progval

Slightly off-topic, but there is one now: https://github.com/Chocobozzz/PeerTube

Ae, and if desktop BT clients can be modified to support WebTorrent, we can help PeerTube sites to serve videos we want to help more people see, just by downloading them from the site and seeding them as we do with normal torrents.

strypey avatar Jun 27 '18 14:06 strypey

Seems like this is the most requested feature atm

jimmywarting avatar Jul 23 '18 20:07 jimmywarting

Sorry if I repeat myself. WebRTC is a complex protocol, and adding it to desktop clients is not trivial. On the other hand, it would be easy for the WebTorrent people to add support for peer connections over WebSockets, which is a simple and elegant protocol, and one that is easily implemented in desktop clients.

Folks, please have a chat with the WebTorrent people and have them design a protocol extension to work over WebSockets. Then we can talk.

jech avatar Aug 28 '18 19:08 jech

Seems like there is something going on here: https://github.com/webtorrent/webtorrent/pull/881 regarding a protocol over WebSockets.

It have been staled for quite a bit now 😕 don't know how well up to date it is

jimmywarting avatar Aug 28 '18 20:08 jimmywarting

I may be confused, but I believe that the linked discussion only refers to tracker communication, not to peer-to-peer communication, the latter being still supported over WebRTC. Which is silly, given the complexity of WebRTCl and the simplicity and elegance of WebSockets.

jech avatar Aug 28 '18 21:08 jech

@jech: I'm not sure how WebSocket fits into a peer-to-peer data transfer protocol, because:

  1. it's TCP, so no NAT hole punching, and
  2. it would require roles since one of the peers would have to be the server and the other the client, and
  3. there is no way to create a WebSocket server in the browser. Thus, there is no advantage in using it over the existing protocols.

So, if you want to communicate with browsers (without any special plugins), WebRTC is the only choice at the moment.

lgrahl avatar Aug 28 '18 21:08 lgrahl

Hi all, I've been brainstorming how WebSockets might play a role as a WebRTC alternative. I agree that we need something that's much simpler to implement.

I wrote up an issue with a potential approach here: https://github.com/webtorrent/webtorrent/issues/1492 Feedback welcome!

feross avatar Aug 29 '18 19:08 feross

As a late reply: WebRTC is complex. No doubt about it. But there are (supposedly) easy to use libraries. And if they aren't as easy to use as they claim to be, let them know.

For example, one can start with this relatively easy example and then ping me as soon as it sucks, so we can work something out.

lgrahl avatar Aug 29 '18 21:08 lgrahl

Can anyone from the Transmission crew comment on the viability of using the RawRTC library to support WebTorrent, instead of a hack based on WebSockets, as mentioned here? https://github.com/webtorrent/webtorrent/issues/1492#issuecomment-417255442

@lgrahl has offered help with this in a few issue threads I've read around this.

strypey avatar Aug 30 '18 11:08 strypey

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 0.6 ETH (53.14 USD @ $88.57/ETH) attached to it.

gitcoinbot avatar Dec 08 '18 13:12 gitcoinbot

Issue Status: 1. Open 2. Cancelled


Work has been started.

These users each claimed they can complete the work by 6 months from now. Please review their action plans below:

1) edwardzyc has started work.

I'll look into how other clients implement this and submit a PR to transmission. 2) drxtreme has started work.

This is my first time on Git coin, I will try my best to deliver the functionality as fast as possible, i use the software myself on Ubuntu 18.10

Learn more on the Gitcoin Issue Details page.

gitcoinbot avatar Dec 11 '18 09:12 gitcoinbot

@uriva there's your open source youtube https://github.com/Chocobozzz/PeerTube/blob/develop/FAQ.md#can-i-seed-videos-with-my-classic-bittorrent-client-transmission-rtorrent but we need good torrent clients like transmission to support webrtc to let people seed videos en masse in the background without having to watch them.

kevATin avatar Dec 15 '18 07:12 kevATin

https://github.com/rawrtc/rawrtc

is a WebRTC C lib that is not complicated and is already working for our use case the people only need to integrate it

frank-dspeed avatar Jan 11 '19 05:01 frank-dspeed

Issue Status: 1. Open 2. Cancelled


The funding of 0.6 ETH (149.92 USD @ $249.86/ETH) attached to this issue has been cancelled by the bounty submitter

gitcoinbot avatar Jun 04 '19 15:06 gitcoinbot

Is there any interface to add this using a plugin in a different language or does this have to be done in C? I can't find whether Transmission can have plugins beyond those that access peers, and are called before and after torrents start.

I'd be willing to have a look, but not in C/C++.

LoveIsGrief avatar Jun 30 '19 21:06 LoveIsGrief

I've recently put together a library under LGPLv2 implementing WebRTC Data Channels in C++ to power another of my projects. I think it can help WebTorrent implementation here, and I'd be glad if it can be useful: https://github.com/paullouisageneau/libdatachannel

paullouisageneau avatar Oct 02 '19 07:10 paullouisageneau

Any news on this?

LunaSquee avatar Apr 27 '20 12:04 LunaSquee

I wrote an implementation for libtorrent (PR is https://github.com/arvidn/libtorrent/pull/4123), I'm looking into transmission and I think I should be able to add support too when I get the time. To this end, I added a C API to libdatachannel: rtc.h

paullouisageneau avatar Apr 28 '20 08:04 paullouisageneau

I found this thread after reading about the addition of WebTorrent to the libtorrent library. Excellent work @paullouisageneau.

I have unfortunately still not read anything that suggests the two big clients that use libtorrent (Deluge and qBittorrent) have been updated to implement that WebTorrent support and I did check the official sites and changelogs etc. Maybe it's just been added silently or I missed something.

Vuze and its open source cousin BiglyBT have supported it for a while but in a very hacky way (they both have to open a Chromium window to implement WebRTC) and in any case both pieces of software are ugly and bloated at least in my opinion.

I would love to see Transmission add this feature in a clean native manner. I hope it becomes a reality soon.

Would happily help in this effort myself if I could write C...

ftpmorph avatar Oct 08 '20 18:10 ftpmorph

I have unfortunately still not read anything that suggests the two big clients that use libtorrent (Deluge and qBittorrent) have been updated to implement that WebTorrent support and I did check the official sites and changelogs etc. Maybe it's just been added silently or I missed something.

It has to be included in a versioned release of libtorrent before it is available generically in big clients. In the meantime, the support requires building against the master branch of libtorrent.

paullouisageneau avatar Oct 08 '20 22:10 paullouisageneau