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

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

B498d33041627b07726dc29c28f02df7?s=128

Feross Aboukhadijeh

May 23, 2015
Tweet

Transcript

  1. WebRTC Everywhere by Feross

  2. WebRTC Beyond the Browser

  3. 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.
  4. 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) }) })
  5. Astro Bob Ren Daniel Posch Feross Aboukhadijeh Iván Todorovich John

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

  7. POWER TO THE PEOPLE

  8. Freedom

  9. True personal computing

  10. WebRTC

  11. 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!
  12. WebRTC Data Channel

  13. 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!
  14. WebRTC Whiteboard Demo

  15. WebRTC Whiteboard whiteboard.webtorrent.io

  16. WebRTC Whiteboard whiteboard.webtorrent.io github.com/feross/whiteboard

  17. Another unintended consequence... WebRTC beyond the browser

  18. 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
  19. WebRTC is universal

  20. Only transport that works in the browser

  21. You get NAT traversal for free

  22. No cross-origin policy

  23. Mandatory transport encryption

  24. Data Channel API is easy! var channel = peer.createDataChannel() channel.send('hi')

    channel.addEventListener('message', function (event) { console.log('got message: ' + event.data) })
  25. Where does WebRTC work today?

  26. 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
  27. 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
  28. 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
  29. 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!
  30. Electron is awesome!

  31. Same code in both places Demo

  32. friends github.com/moose-team/friends

  33. You can run it headless! github.com/maxogden/electron-spawn

  34. </hype>

  35. There are challenges, and even some deal breakers

  36. WebRTC deal breakers

  37. 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
  38. Not as lightweight as UDP 4 Even after optimization, it

    won't ever be
  39. No IE/Safari support yet 4 Consider using Temasys plugin 4

    Microsoft Edge support coming soon
  40. WebRTC challenges

  41. Offer/answer connection model 4 IP/UDP/TCP is like calling a phone

    number 4 WebRTC is like getting set up on a date
  42. Single points of failure remain!

  43. In browser, you need a domain name 4 Possible solution:

    Make it work offline! 4 hyperboot.org 4 Service Workers
  44. 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
  45. 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
  46. Privacy leak 4 Any webpage can query your local IPs

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

    backpressure is hacky 4 bufferedAmount 4 setInteval
  48. Despite challenges, we should rally around WebRTC

  49. We need more P2P apps

  50. We need more P2P primitives

  51. LET'S MAKE THE MAN A BIT HUMBLER

  52. "The sharing economy is mainly owned by the 1%" @jowyang

  53. simple-peer

  54. None
  55. None
  56. 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 ...
  57. bittorrent-dht

  58. Learn more about WebRTC "html5rocks webrtc basics" webrtchacks.com "simple-peer" on

    npm
  59. Learn more about WebTorrent webtorrent.io instant.io