Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebTorrent support #4123

Merged
merged 12 commits into from
Jul 1, 2020
Merged

WebTorrent support #4123

merged 12 commits into from
Jul 1, 2020

Conversation

paullouisageneau
Copy link
Contributor

@paullouisageneau paullouisageneau commented Nov 25, 2019

This PR suggests an implementation of the WebTorrent protocol inside libtorrent. With this add-on, libtorrent can be used to run hybrid peers seamlessly.

WebTorrent peers use the same application protocol as classic peers but with WebRTC Data Channels as underlying transport instead of uTP or TCP, allowing to run peers in web browsers. Due to the necessary connection signaling, WebTorrent peers require a specific WebSocket tracker to connect.

Since documentation seems to be lacking, I implemented the WebTorrent signaling protocol the best I could guess by looking at existing code. You can find useful information and the reference Javascript implementation here: https://github.com/webtorrent/webtorrent

The implementation requires two external dependencies added as submodules:

  • libdatachannel, my lightweight WebRTC Data Channels implementation, which relies on my ad-hoc UDP Interactive Connectivity Establishment (ICE) library libjuice
  • boost.JSON, a header-only JSON library for the tracker protocol

This PR does not add new external dependencies to libtorrent (it only requires OpenSSL or GnuTLS depending on the compilation option).

To test, you need a torrent file with at least one WebSocket tracker, for instance wss://tracker.openwebtorrent.com.
You can find such a torrent file here: https://ageneau.org/upload/sintel.torrent
You can also run a web browser peer on this page: https://webtorrent.io/

src/torrent.cpp Outdated Show resolved Hide resolved
src/torrent.cpp Outdated Show resolved Hide resolved
src/rtc_stream.cpp Outdated Show resolved Hide resolved
src/rtc_stream.cpp Outdated Show resolved Hide resolved
src/rtc_stream.cpp Outdated Show resolved Hide resolved
src/rtc_stream.cpp Outdated Show resolved Hide resolved
src/rtc_stream.cpp Outdated Show resolved Hide resolved
src/rtc_stream.cpp Outdated Show resolved Hide resolved
src/rtc_stream.cpp Outdated Show resolved Hide resolved
@frankenstein91
Copy link

is there any info on which clients are already working with it (webtorrent)?

@tuxayo
Copy link

tuxayo commented Dec 25, 2020

It's not released yet, more info in the previous messages.

@Clodo76
Copy link

Clodo76 commented Jan 9, 2021

I hope in progress of this integration, this world need an implementation to share web-based p2p content.
i just donate 1000€ to the bitcoin address of libtorrent project, i hope can help.

@paullouisageneau
Copy link
Contributor Author

@Clodo76 That's very nice of you, however for now I'm the only one maintaining the integration. Any contribution to help to test and fix issues (for instance #5831) is welcome!

@gubatron
Copy link
Contributor

is webtorrent support built as a default feature, or does it need to be specified with some build flags?

Can't find anything in Build Features or any examples on how to enable webtorrent.

@paullouisageneau
Copy link
Contributor Author

paullouisageneau commented Apr 20, 2022

@gubatron Webtorrent support is present only on master branch for now, not on RC_2_0 branch, and it requires the build feature webtorrent to be enabled

target_optional_compile_definitions(torrent-rasterbar PUBLIC FEATURE NAME webtorrent DEFAULT OFF

@petterreinholdtsen
Copy link

petterreinholdtsen commented Apr 20, 2022 via email

@petterreinholdtsen
Copy link

petterreinholdtsen commented Oct 7, 2022 via email

@leoherzog
Copy link

Any news on when we'll get this build flag enabled by default in a release?

@plotasse
Copy link

hello friends ! it seems peertube is having trouble finding bandwidth and storage in these hard times.

webtorrent support in mainstream clients may be a great step towards decentralized video hosting, which is arguably very needed when traditionnal models such as youtube are beginning to show their limits.

seeing the code is already there, please make an official release with this support if you can!

i am willing to help if any more development is needed.

anyway, thanks for making this awesome software and making the world a better place. cheers!~

@leoherzog
Copy link

Unfortunately, PeerTube 6 (out now) has dropped WebTorrent support.

We needed to settle a technical debt : v6 removes support for WebTorrent to focus on HLS (with WebRTC P2P). Both are technical bricks used to get peer-to-peer streaming in web browsers, but HLS is more fitted to what we are doing (and plan to do) with PeerTube

https://framablog.org/2023/11/28/peertube-v6-is-out-and-powered-by-your-ideas/

@plotasse
Copy link

oof

@petterreinholdtsen
Copy link

petterreinholdtsen commented Nov 30, 2023 via email

@leoherzog
Copy link

leoherzog commented Nov 30, 2023

I would still love to see WebTorrent support included in the default builds of libtorrent, of course. The functionality has already been developed. It would be nice to get that enabled.

@petterreinholdtsen
Copy link

I agree. I eagerly await a VLC bittorrent plugin with WebTorrent support in Debian, and this depend on a release of libtorrent with WebTorrent support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.