Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WebTorrent: Bringing P2P to the masses with WebRTC

WebTorrent: Bringing P2P to the masses with WebRTC

Talk Title: WebTorrent: Bringing P2P to the masses with WebRTC
Speaker: Feross Aboukhadijeh
Conference: SIGNAL Conference 2016

Learn more about WebTorrent at https://webtorrent.io

Feross Aboukhadijeh

May 24, 2016
Tweet

More Decks by Feross Aboukhadijeh

Other Decks in Technology

Transcript

  1. P2P ADVANTAGES > Censorship resistant > Privacy preserving > User

    controls their data > Safe against user-hostile changes
  2. P2P APPLICATIONS > Currency Bitcoin > Web Tor, I2P, Freenet

    > Storage IPFS, Tahoe > Computation Ethereum > File sharing BitTorrent, WebTorrent
  3. APPLICATIONS THAT USE P2P > Communication Skype, Hangouts > Music

    Spotify > OS Windows Update > Game Updates Blizzard, EVE Online > Content Delivery Network PeerCDN
  4. P2P APPLICATIONS > Currency Bitcoin > Web Tor, I2P, Freenet

    > Storage IPFS, Tahoe > Computation Ethereum > File sharing BitTorrent, WebTorrent
  5. The way we code the Web will determine the way

    we live online. So we need to bake our values into our code. — Brewster Kahle, Internet Archive
  6. > WebRTC in web apps (desktop & mobile) > WebRTC

    in desktop apps > WebRTC in mobile apps > WebRTC in server/cli apps
  7. var WebTorrent = require('webtorrent') var client = new WebTorrent() client.add('magnet:...',

    function (torrent) { var file = torrent.files[0] // Display the file by adding it to the DOM. // Supports video, audio, image files, and more! file.appendTo('body') })
  8. HTTP/UDP TRACKERS 1. Send message to tracker (info hash, IP

    address, port) 2. Receive response with list of peers 3. Tracker adds you to list of peers
  9. WEBSOCKET TRACKERS 1. Open WebSocket connection to tracker 2. Send

    message (info hash, WebRTC offers) 3. Receive some WebRTC answers 4. Keep WebSocket open to receive remote offers
  10. WEBTORRENT ON NPM > Lightweight (just 75 KB) > Pure

    JavaScript (no native dependencies) > Full-featured (magnet uris, dht, tracker, pex) > Stream from files (On-demand piece prioritization)