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

WebRTC - for when μ seconds are not fast enough

Jason S.
September 02, 2016

WebRTC - for when μ seconds are not fast enough

Jason S.

September 02, 2016
Tweet

Other Decks in Programming

Transcript

  1. • What is WebRTC? • How do you use it?

    • Demo • Technical Bits • Future!
  2. P2P

  3. And more! • Easiest way to deploy a P2P/audio/video application

    • Encrypted • Lowest possible latency
  4. The Offer • What each browser is capable of doing

    • What each browser wants to do with this connection • What encryption it can/wants to do • What protocol to speak • IETF RFC 3264 https://www.ietf.org/rfc/rfc3264.txt
  5. 1.Create an offer to connect 2.Send the offer to another

    browser, “Signaling” 3.Send data back and forth
  6. var SimplePeer = require('simple-peer') var peer = new Peer({ initiator:

    true, trickle: false }) peer.on('error', function (err) { console.log('error', err) }) peer.on('signal', function (offer) { // Offer is ready to send to B, Signaling console.log('SIGNAL', JSON.stringify(offer)) }) // Accept an offer from your friend B, Signaling peer.signal(JSON.parse(bOffer)) peer.on('connect', function () { // Send the data after a connection is made peer.send('whatever' + Math.random()) }) // Receive data from B/ peer.on('data', function (data) { console.log('data: ' + data) })