![Page 1: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/1.jpg)
WEB TORRENTBRINGING P2P TO THE MASSES
WITH WEBRTC
![Page 2: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/2.jpg)
ONCE UPON A TIME...
![Page 3: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/3.jpg)
![Page 4: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/4.jpg)
RESILIENT
![Page 5: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/5.jpg)
![Page 6: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/6.jpg)
NO MIDDLEMEN
![Page 7: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/7.jpg)
DIVERSE
![Page 8: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/8.jpg)
PEOPLE POWERED
![Page 9: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/9.jpg)
P2PPEER TO PEER
![Page 10: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/10.jpg)
P2P ADVANTAGES
> Censorship resistant> Privacy preserving
> User controls their data> Safe against user-hostile changes
![Page 11: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/11.jpg)
P2P APPLICATIONS
> Currency Bitcoin> Web Tor, I2P, Freenet> Storage IPFS, Tahoe
> Computation Ethereum> File sharing BitTorrent, WebTorrent
![Page 12: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/12.jpg)
APPLICATIONS THAT USE P2P
> Communication Skype, Hangouts> Music Spotify
> OS Windows Update> Game Updates Blizzard, EVE Online> Content Delivery Network PeerCDN
![Page 13: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/13.jpg)
CENTRALIZED APPS
> ALL THE REST
![Page 14: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/14.jpg)
SERVER → CLIENT
![Page 15: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/15.jpg)
MAINFRAME → PC → CLOUD → ?
![Page 16: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/16.jpg)
PEER ↔ PEER
![Page 17: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/17.jpg)
P2P APPLICATIONS
> Currency Bitcoin> Web Tor, I2P, Freenet> Storage IPFS, Tahoe
> Computation Ethereum> File sharing BitTorrent, WebTorrent
![Page 18: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/18.jpg)
WEB APPSTRAPPED IN THE BROWSER
![Page 19: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/19.jpg)
DOMAINS, DNS, URLS
![Page 20: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/20.jpg)
WEB ≠ P2P
![Page 21: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/21.jpg)
WHAT IF IT WAS?
![Page 22: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/22.jpg)
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
![Page 23: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/23.jpg)
WEB RTCREAL TIME COMMUNICATIONS
![Page 24: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/24.jpg)
DATA CHANNELHIDDEN GEM IN WEBRTC
![Page 25: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/25.jpg)
DATA CHANNEL APIvar channel = peer.createDataChannel()
channel.send('hi')
channel.addEventListener('message', function (event) { console.log('got message: ' + event.data)})
![Page 26: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/26.jpg)
THE ONLY P2P TRANSPORTTHAT WORKS IN THE BROWSER
![Page 27: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/27.jpg)
NAT TRAVERSAL
![Page 28: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/28.jpg)
NO CROSS-ORIGIN POLICY
![Page 29: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/29.jpg)
TRANSPORT ENCRYPTION
![Page 30: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/30.jpg)
WEBRTC DATA CHANNELIS UNIVERSAL
![Page 31: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/31.jpg)
> WebRTC in web apps (desktop & mobile)> WebRTC in desktop apps> WebRTC in mobile apps
> WebRTC in server/cli apps
![Page 32: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/32.jpg)
BUILD P2P APPS
![Page 33: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/33.jpg)
BUILD P2P PROTOCOLS
![Page 34: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/34.jpg)
![Page 35: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/35.jpg)
TORRENT CLIENTFOR THE WEB
![Page 36: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/36.jpg)
DEMO
![Page 37: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/37.jpg)
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')})
![Page 38: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/38.jpg)
WEBTORRENT PROTOCOLIS 95% BITTORRENT
![Page 39: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/39.jpg)
BITTORRENT WIRE PROTOCOL
> TCP> uTP (UDP)> WebRTC
![Page 40: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/40.jpg)
BITTORRENT TRACKER PROTOCOL
> HTTP> UDP
> WebSocket
![Page 41: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/41.jpg)
HTTP/UDP TRACKERS
1. Send message to tracker (info hash, IP address, port)2. Receive response with list of peers3. Tracker adds you to list of peers
![Page 42: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/42.jpg)
OFFER. ANSWER.
![Page 43: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/43.jpg)
WEBSOCKET TRACKERS
1. Open WebSocket connection to tracker2. Send message (info hash, WebRTC offers)
3. Receive some WebRTC answers4. Keep WebSocket open to receive remote offers
![Page 44: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/44.jpg)
WIRE PROTOCOL IS 100% THE SAME
![Page 45: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/45.jpg)
BITTORRENT TRACKER PROTOCOL
> HTTP> UDP
> WebSocket
![Page 46: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/46.jpg)
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)
![Page 47: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/47.jpg)
DESKTOP APP
![Page 48: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/48.jpg)
WEBTORRENT DESKTOP
![Page 49: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/49.jpg)
![Page 50: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/50.jpg)
![Page 51: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/51.jpg)
AIRPLAY, CHROMECAST, CLOSED CAPTIONS
![Page 52: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/52.jpg)
DEMO
![Page 53: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/53.jpg)
ELECTRONBUILD CROSS PLATFORM DESKTOP APPS
WITH JAVASCRIPT, HTML, & CSS
![Page 54: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/54.jpg)
PERFECT FOR WEBTORRENT DESKTOP
![Page 55: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/55.jpg)
PERFECT FOR WEBRTC APPS
![Page 56: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/56.jpg)
NODE.JS + CHROME
![Page 57: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/57.jpg)
ELECTRON INCLUDES WEBRTC
![Page 58: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/58.jpg)
WORKS IN NODE.JS & THE BROWSER
![Page 59: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/59.jpg)
TORRENT TRANSPORTS
> BitTorrent TCP/UDP> WebTorrent WebRTC
![Page 60: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/60.jpg)
TORRENT TRANSPORTS
> Node.js → TCP/UDP
> Browser → WebRTC
> Electron → TCP/UDP, WebRTC
![Page 61: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/61.jpg)
WEBTORRENT DESKTOP ISA HYBRID TORRENT CLIENT
![Page 62: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/62.jpg)
TALKS TO TRADITIONAL TORRENT CLIENTS& BROWSER TORRENT CLIENTS
![Page 63: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/63.jpg)
OS INTEGRATION
![Page 64: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/64.jpg)
![Page 65: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/65.jpg)
![Page 66: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/66.jpg)
![Page 67: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/67.jpg)
![Page 68: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/68.jpg)
![Page 69: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/69.jpg)
AUTO UPDATER
![Page 70: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/70.jpg)
WEBRTC EVERYWHERE
![Page 71: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/71.jpg)
LEARN MOREAT WEBTORRENT.IO
![Page 72: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC](https://reader034.vdocuments.us/reader034/viewer/2022042723/586fe0701a28ab18428b7347/html5/thumbnails/72.jpg)
THANKS!SAY HI AT @FEROSS OR FEROSS.ORG