72
WEB TORRENT BRINGING P2P TO THE MASSES WITH WEBRTC

Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

Embed Size (px)

Citation preview

Page 1: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

WEB TORRENTBRINGING P2P TO THE MASSES

WITH WEBRTC

Page 2: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

ONCE UPON A TIME...

Page 3: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Page 4: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

RESILIENT

Page 5: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Page 6: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

NO MIDDLEMEN

Page 7: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

DIVERSE

Page 8: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

PEOPLE POWERED

Page 9: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

P2PPEER TO PEER

Page 10: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

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

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

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

CENTRALIZED APPS

> ALL THE REST

Page 14: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

SERVER → CLIENT

Page 15: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

MAINFRAME → PC → CLOUD → ?

Page 16: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

PEER ↔ PEER

Page 17: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

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

WEB APPSTRAPPED IN THE BROWSER

Page 19: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

DOMAINS, DNS, URLS

Page 20: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

WEB ≠ P2P

Page 21: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

WHAT IF IT WAS?

Page 22: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

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

WEB RTCREAL TIME COMMUNICATIONS

Page 24: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

DATA CHANNELHIDDEN GEM IN WEBRTC

Page 25: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

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

THE ONLY P2P TRANSPORTTHAT WORKS IN THE BROWSER

Page 27: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

NAT TRAVERSAL

Page 28: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

NO CROSS-ORIGIN POLICY

Page 29: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

TRANSPORT ENCRYPTION

Page 30: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

WEBRTC DATA CHANNELIS UNIVERSAL

Page 31: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

> 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

BUILD P2P APPS

Page 33: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

BUILD P2P PROTOCOLS

Page 34: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Page 35: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

TORRENT CLIENTFOR THE WEB

Page 36: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

DEMO

Page 37: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

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

WEBTORRENT PROTOCOLIS 95% BITTORRENT

Page 39: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

BITTORRENT WIRE PROTOCOL

> TCP> uTP (UDP)> WebRTC

Page 40: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

BITTORRENT TRACKER PROTOCOL

> HTTP> UDP

> WebSocket

Page 41: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

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

OFFER. ANSWER.

Page 43: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

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

WIRE PROTOCOL IS 100% THE SAME

Page 45: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

BITTORRENT TRACKER PROTOCOL

> HTTP> UDP

> WebSocket

Page 46: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

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

DESKTOP APP

Page 48: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

WEBTORRENT DESKTOP

Page 49: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Page 50: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Page 51: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

AIRPLAY, CHROMECAST, CLOSED CAPTIONS

Page 52: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

DEMO

Page 53: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

ELECTRONBUILD CROSS PLATFORM DESKTOP APPS

WITH JAVASCRIPT, HTML, & CSS

Page 54: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

PERFECT FOR WEBTORRENT DESKTOP

Page 55: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

PERFECT FOR WEBRTC APPS

Page 56: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

NODE.JS + CHROME

Page 57: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

ELECTRON INCLUDES WEBRTC

Page 58: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

WORKS IN NODE.JS & THE BROWSER

Page 59: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

TORRENT TRANSPORTS

> BitTorrent TCP/UDP> WebTorrent WebRTC

Page 60: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

TORRENT TRANSPORTS

> Node.js → TCP/UDP

> Browser → WebRTC

> Electron → TCP/UDP, WebRTC

Page 61: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

WEBTORRENT DESKTOP ISA HYBRID TORRENT CLIENT

Page 62: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

TALKS TO TRADITIONAL TORRENT CLIENTS& BROWSER TORRENT CLIENTS

Page 63: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

OS INTEGRATION

Page 64: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Page 65: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Page 66: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Page 67: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Page 68: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC
Page 69: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

AUTO UPDATER

Page 70: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

WEBRTC EVERYWHERE

Page 71: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

LEARN MOREAT WEBTORRENT.IO

Page 72: Twilio Signal 2016 Bringing P2P to the Masses with WebRTC

THANKS!SAY HI AT @FEROSS OR FEROSS.ORG