Warning: This is pre-alpha software. Nothing works yet. Watch/star to follow along with progress.
- Fix bugs, add features. Join
#webtorrent
on Freenode. Take a look at the open issues on this repo and the others see what you can help with. - Donations. If you believe in the vision, send bitcoin to 1B6aystcqu8fd6ejzpmMFMPRqH9b86iiwh or donate via Coinbase.
There is a single repo (webtorrent-issues) for managing publicly recognized issues with the webtorrent client, tracker, and website.
- BitTorrent in your browser!
- No plugins (uses WebRTC Data Channels for peer-to-peer data)
- Streaming playback (get first pieces first)
- Into
video
tag with MediaSource API when possible - Flash player with JS bridge for other media types
- Into
- Works with .torrent files and magnet links
- Supports DHT (trackerless torrents) over WebRTC
- Extensions to DHT protocol to work over WebRTC
- DHT nodes do "peer introductions" so WebRTC can work without a centralized signaling server
- Supports completely serverless, trackerless operation
Build a browser BitTorrent client that requires no install (no plugin/extension/etc.) and fully-interoperates with the regular BitTorrent network. Use WebRTC Data Channels for peer-to-peer transport.
Since WebTorrent is web-first, it's simple for users who do not understand .torrent files, magnet links, NATs, etc. By making BitTorrent easier, it will be accessible to new swathes of users who were previously intimidated, confused, or unwilling to install a program on their machine to participate.
Most of the active development is happening inside of small npm modules which are used by WebTorrent. These are the modules I am writing to make WebTorrent work:
module | tests | version | description |
---|---|---|---|
bittorrent-client | full torrent client | ||
bittorrent-dht | bittorrent dht client | ||
bittorrent-peerid | identify client name/version | ||
bittorrent-protocol | bittorrent protocol stream | ||
bittorrent-swarm | bittorrent connection manager | ||
bittorrent-tracker | bittorrent tracker server/client | ||
buffer | node buffer api for the browser | ||
create-torrent | create .torrent files | ||
magnet-uri | parse magnet uris | ||
parse-torrent | parse torrent identifiers | ||
parse-torrent-file | parse .torrent files | ||
simple-peer | webrtc wrapper api | ||
simple-websocket | websocket wrapper api | ||
string2compact | convert 'hostname:port' to compact | ||
torrent-discovery | find peers via dht and tracker | ||
typedarray-to-buffer | efficient buffer creation | ||
ut_metadata | get metadata for magnet uris (ext) | ||
ut_pex | peer discovery (ext) | ||
webtorrent-swarm | webtorrent connection management | ||
webtorrent-tracker | webtorrent tracker server/client |
- compress-sdp (compress sdp messages to lighten load on webtorrent trackers & dht)
- protocol extension: protocol encryption
- protocol extension: µTP
- protocol extension: UPnP and NAT-PMP port forwarding
- protocol extension: webseed support
- webtorrent-dht
- webtorrent.app (bittorrent client for os x, windows & linux -- coming soon)
- webtorrent.js (bittorrent client for the browser -- coming soon)
- webtorrent (bittorrent client for node.js)
"When applications are done well, they are just the really application-specific, brackish residue that can't be so easily abstracted away. All the nice, reusable components sublimate away onto github and npm where everybody can collaborate to advance the commons." — substack from "how I write modules"
Problem: WebTorrent clients and normal BitTorrent clients cannot directly connect because WebRTC cannot open UDP/TCP sockets. This is a security restriction on WebRTC that is unlikely to change. So, how do we get content into the WebTorrent network?
Best solution: Mainstream BitTorrent clients add support for WebTorrent. Basically, normal clients implement WebRTC so that WebTorrent clients can directly connect to them. (This could happen once WebTorrent has a lot of users.)
Good solution: Users who want to download torrents that aren't yet seeded by any WebTorrent users need to install a "hybrid client" that implements WebTorrent and BitTorrent. This can be implemented as a native torrent client that bridges the two networks like this:
- Hybrid clients can seed+leech from both WebTorrent and BitTorrent users.
- Hybrid clients are DHT nodes in both the WebTorrent and BitTorrent DHTs.
- The first time a hybrid client downloads a torrent that no other WebTorrent clients are seeding, they become the first WebTorrent seeder. (They essentially "bring" the file into the WebTorrent network).
- Important note: Hybrid clients never download torrents on behalf of other users. That would be a terrible idea.
- Until BitTorrent clients support WebTorrent, "pure" WebTorrent clients can only download from other WebTorrent clients.
- WebTorrent is slower at finding peers since "DHT over WebRTC" requires multiple roundtrips for peer introductions. (This is a requirement of WebRTC signaling - no way around this)
- WebTorrent peers must keep their browser tab open to seed (Show UI to encourage seeding back at least 2x)
- Slower piece verification (SHA1) (max 2MB/s with web worker pool, Web Crypto API will bring huge speed-up when it's finally ready)
- WebTorrent bootstrap DHT node does a bit more work than a BitTorrent one since it must do WebRTC signaling. (Not a huge deal)
Use UDP/TCP APIsSupport DHTSupport peer wire protocolSupport magnet links (fetching .torrent from network)Basic UIFetching logicLarge file saving (downloading in-memory for now, later IndexedDB/FileSystem API)Streaming videoHTTP stream to VLC, like peerflix
- DHT over WebRTC (add new method for peer introduction)
- Use bootstrap server for initial introduction
- POST endpoint for sending offer/getting answer
- Easy torrent creation
- UPnP or NAT-PMP (so the hybrid client can get listed in peers' routing tables)
- Streaming video
- MediaSource into
video
tag - Flash player for other media types
- MediaSource into
git clone https://github.com/feross/webtorrent.git
cd webtorrent
npm install
npm start
Chromebooks are set to refuse all incoming connections by default. To change this, run:
sudo iptables -P INPUT ACCEPT
WebTorrent is only possible due to the excellent work of the following contributors:
Feross Aboukhadijeh | GitHub/feross | Twitter/@feross |
---|---|---|
Daniel Posch | GitHub/dcposch | Twitter/@dcposch |
John Hiesey | GitHub/jhiesey | Twitter/@jhiesey |
Travis Fischer | GitHub/fisch0920 | Twitter/@fisch0920 |
Astro | GitHub/astro | Twitter/@astro1138 |
Iván Todorovich | GitHub/ivantodorovich | Twitter/@ivantodorovich |
Mathias Buus | GitHub/mafintosh | Twitter/@mafintosh |
Bob Ren | GitHub/bobrenjc93 | Twitter/@bobrenjc93 |
- WebTorrent: Bringing BitTorrent to the Web with WebRTC (CraftConf) (April 2014, progress update on WebTorrent)
- WebRTC Black Magic (RealtimeConf) (October 2013, where I first shared the idea for WebTorrent (skip to end for WebTorrent))
MIT. Copyright (c) Feross Aboukhadijeh.