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

LWPG: The Future Is Realtime

Avatar for miksago miksago
October 20, 2011

LWPG: The Future Is Realtime

A slightly more technical version of the The Future Is Realtime talk I've been doing recently.

Avatar for miksago

miksago

October 20, 2011
Tweet

More Decks by miksago

Other Decks in Programming

Transcript

  1. • Part 1: Background & History • Overview of the

    past • The Shift to Realtime • Realtime Web in Action
  2. • Early web • PHP / LAMP Stack • MVC

    • Social Web Overview of the past
  3. The Shift to Realtime • The web has become more

    interactive • Users expect things to be “now” • And why should they have to wait?
  4. • We researched page-load time • We used AJAX to

    decrease wait-time on interactions • We then tried to simulate “realtime” with AJAX and related technologies The Shift to Realtime
  5. The Simulations of Realtime • HTTP Polling • LiveConnect •

    Forever iFrame • XHR Long-polling • XHR Streaming
  6. What are WebSockets? • Bi-directional socket connection between browser and

    server • API is fairly low level • Low-latency/high-frequency messaging
  7. The Uses of WebSockets • Progressively Realtime Applications • Entirely

    Realtime Applications • Multiplayer HTML5 Gaming
  8. var socket = new WebSocket('ws://localhost:8080/') socket.onopen = function() { /*...*/

    }; socket.onmessage = function(messageEvent) { /*...*/ }; socket.onclose = function(closeEvent) { /*...*/ }; socket.onerror = function() { /*...*/ }; socket.send('my data'); The WebSocket API
  9. var socket = new WebSocket(url, protocol) var socket = new

    WebSocket(url, [protocol1, protocol2]) socket.addEventListener('open', function() { /*...*/ }); socket.addEventListener('message', /*...*/ ); socket.addEventListener('close', /*...*/ ); socket.addEventListener('error', /*...*/ ); The WebSocket API (alt)
  10. WebSocket Servers • worlize/WebSocket-node • miksago/node-websocket-server • oberstet/Autobahn (python) •

    igrigorik/em-websocket (ruby) • Jetty/7.5.2 (java) • ostinelli/misultin (erlang)
  11. Warning! There are currently multiple versions of WebSockets supported by

    Browsers, not all of the previously listed Servers support all the versions.