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

WebRTC Everywhere (Beyond the Browser) @ Data T...

WebRTC Everywhere (Beyond the Browser) @ Data Terra Nemo 2015

Talk by Feross Aboukhadijeh (that's me!) at Data Terra Nemo 2015 (http://dtn.is).

https://webtorrent.io
https://instant.io
http://feross.org

Feross Aboukhadijeh

May 23, 2015
Tweet

More Decks by Feross Aboukhadijeh

Other Decks in Technology

Transcript

  1. WebTorrent 4 BitTorrent in the browser 4 True P2P implementation

    – not just a proxy 4 No install – pure JavaScript with WebRTC 4 Exposes files as node-style streams 4 Stream into <video>, <audio>, VLC, Chromecast, Airplay, etc.
  2. var WebTorrent = require('webtorrent') var client = new WebTorrent() client.add('magnet:...',

    function (torrent) { console.log('Got torrent metadata!', torrent.infoHash) torrent.files.forEach(function (file) { var video = document.createElement('video') document.body.appendChild(video) file.createReadStream().pipe(video) }) })
  3. Astro Bob Ren Daniel Posch Feross Aboukhadijeh Iván Todorovich John

    Hiesey Joseph Dykstra Mathias Buus Travis Fischer many more...
  4. P2P

  5. WebRTC is a backdoor 4 Companies just want browser video

    chat 4 But they're building P2P into the fabric of the web 4 Let's use this opportunity!
  6. Data Channel Unintended Consequences 4 Peer-assisted delivery (PeerCDN, Peer5, others)

    4 File transfer (WebTorrent, Sharefest) 4 Website hosting over torrents 4 Chat/email/encrypted real-time communications 4 All future P2P protocols!
  7. This is WebRTC Everywhere 4 WebRTC in web apps (desktop

    & mobile) 4 WebRTC in desktop apps 4 WebRTC in server apps 4 WebRTC in mobile apps
  8. Data Channel API is easy! var channel = peer.createDataChannel() channel.send('hi')

    channel.addEventListener('message', function (event) { console.log('got message: ' + event.data) })
  9. WebRTC support in Web Apps 4 Google Chrome - supported

    4 Mozilla Firefox - supported 4 Opera - supported 4 Microsoft Edge (next IE) - planned 4 Apple Safari - no comment
  10. WebRTC support in Desktop apps 4 Electron (atom-shell) - easiest

    choice! 4 NW.js (node-webkit) - also super easy! 4 Google's webrtc.org - compile it into your app 4 Ericsson's OpenWebRTC - compile it into your app
  11. WebRTC support in Server apps 4 wrtc package on npm

    (native dep on webrtc.org) 4 Google's webrtc.org - compile it into your app 4 Ericsson's OpenWebRTC - compile it into your app
  12. WebRTC support in Mobile apps 4 iOS - Google's webrtc.org

    - compile it into your app 4 Android - Use Chromium WebView 4 Or, better: Just use Chrome/Firefox on Android!
  13. No "Data Channel only" build 4 All implementations include media

    component cruft 4 Data channel build: code.google.com/p/webrtc/ issues/detail?id=3892
  14. Offer/answer connection model 4 IP/UDP/TCP is like calling a phone

    number 4 WebRTC is like getting set up on a date
  15. In browser, you need a domain name 4 Possible solution:

    Make it work offline! 4 hyperboot.org 4 Service Workers
  16. Finding peers 4 Easiest way is through a central tracker

    / introducer 4 signalhub (used by Friends) 4 bittorrent-tracker (used by WebTorrent) 4 We need a general purpose WebRTC DHT! 4 webrtc-explorer by David Dias
  17. STUN 4 External service that aids in NAT traversal 4

    Lots of services just use Google's public STUN server 4 You can run your own very cheaply 4 Possible privacy leak, but unlikely
  18. Privacy leak 4 Any webpage can query your local IPs

    4 Chrome disables local candidates on proxy/VPN 4 Tor Browser Bundle disables WebRTC
  19. Streaming is a challenge 4 No readable backpressure 4 Writable

    backpressure is hacky 4 bufferedAmount 4 setInteval
  20. apps that use simple-peer 4 Friends - P2P chat 4

    ScreenCat - Screen sharing 4 WebTorrent - browser torrent client 4 Whiteboard - draw together 4 Lots of experiments: webrtc-explorer, peernet, rtcat, webcat ...