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

Real Time Collaborative Apps with JS by @albertein

gdljs
July 28, 2015

Real Time Collaborative Apps with JS by @albertein

Slides de la segunda plática GDLJS del 28 de Julio.

Un vistazo rápido a distintas tecnologías de JavaScript que permiten a multiples usuarios interactuar en tiempo real, todo esto en el browser. Los pros y contras de tecnologías que van desde polling, y websockets hasta lo más emocionante del mundo de RTC

gdljs

July 28, 2015
Tweet

More Decks by gdljs

Other Decks in Technology

Transcript

  1. What it is? • 2+ people across the web interacting.

    • Google Docs • Chat apps. • Agar.io
  2. Long Polling // Client function poll() { $.ajax({complete: poll, ...});

    } poll(); // Server http.createServer(function(request, response) { onEvent(function(e) { response.end(payload); }); }).listen(8000);
  3. Web sockets • full-duplex • HTTP friendly GET /chat HTTP/1.1

    Host: server.example.com Upgrade: websocket Connection: Upgrade
  4. Server //server var app = require('http').createServer(handler); var io = require('socket.io')(app);

    io.on('connection', function (socket) { socket.on('ping', function (from, msg) { socket.emit('pong'); }); }); app.listen(8000);
  5. ICE/STUN/TURN • ICE for connection negotiation • STUN for discovering

    external address • TURN to relay messages if everything else fails