Transcript
Page 1: Web browsers & the realtime web

Web Browsers &the Realtime Web 

the past, present & future

Techmeetup Edinburgh ­ 08/02/2012

Page 2: Web browsers & the realtime web

Who is this guy?Phil Leggetter

www.leggetter.co.uk

@leggetter

Developer Evangelist at Pusher

Page 3: Web browsers & the realtime web

OverviewWhat is Realtime & the Realtime web

History of browsers & the Realtime web*

What technology can we use now?

Future

Questions

* ­ according to me

Page 4: Web browsers & the realtime web

What is Realtime?

Source: Wikipedia: Realtime Computing

What is the Realtime web?

systems that are subject to a "real-time constraint"— e.g. operationaldeadlines from event to system response

The real-time web is a set of technologies and practices that enableusers to receive information as soon as it is published by its authors,rather than requiring that they or their software check a sourceperiodically for updates.

Page 5: Web browsers & the realtime web

Source: Wikipedia: Realtime web

Page 6: Web browsers & the realtime web

Publish & Subscribe

aliens

+Phil Search Images Videos Maps News Shopping Gmail More

Page 7: Web browsers & the realtime web
Page 8: Web browsers & the realtime web

Why the Realtime Webmatters

Opportunity

Convenience

Interaction

Engagement

Page 9: Web browsers & the realtime web

History (according to me)My first Job = WOW!

Page 10: Web browsers & the realtime web
Page 11: Web browsers & the realtime web
Page 12: Web browsers & the realtime web

Java Applets

<APPLET CODE="real_time_stuff.class" WIDTH=150 HEIGHT=15 MAYSCRIPT>

LiveConnect"Allows Java and JavaScript software tointercommunicate within a Web page"

Applets were a problem.Microsoft had to drop support their JVM (were sued).

Sun Microsystems releases kept breaking stuff.

Page 13: Web browsers & the realtime web

Users/Sys adminsdidn't want toinstall plugins!

Page 14: Web browsers & the realtime web

<frame> Polling

Source

Page 15: Web browsers & the realtime web

<frame> Long­Polling

Source

Page 16: Web browsers & the realtime web

<frame> Streaming

Source

Page 17: Web browsers & the realtime web

XMLHttpRequestIE5 in 1999 via ActiveX

Slowly but surely adopted by all web browser

AllowsPolling

Long­Polling

Streaming

AJAX term coined in 2005The term Ajax was coined on 18 February 2005 byJesse James Garrett in an article entitled "Ajax: A NewApproach to Web Applications"

Page 18: Web browsers & the realtime web

W3C working draft in 2006That's how fast technology used to move!

Page 19: Web browsers & the realtime web

Crossdomain restrictionswww.example.com ­> www.example.com √subdomain.example.com ­> www.example.com√*www.example.com ­> www.leggetter.co.uk X**CORS (Cross Origin Resource Sharing)

Problem: Browser support (FF3.6+, IE8+ etc.)

* you need to set document.domain to be 'example.com'

** there are ways around this with JSONP

Page 20: Web browsers & the realtime web

CometTerm 'coined' in 2006 by Alex Russell

Comet is a web application model inwhich a long-held HTTP request allows aweb server to push data to a browser,without the browser explicitly requestingit. Comet is an umbrella term,encompassing multiple techniques forachieving this interaction.

Page 21: Web browsers & the realtime web
Page 22: Web browsers & the realtime web

WebSocketsA protocol and an API

Single bi­directional connection

Supports cross domain communication

var ws = new WebSocket("ws://mywebsocketserver.com:80");ws.onopen = function() { // connection established};

ws.onmessage = function(data) { // receive a message ws.send("Yep, got: " + data); // send a message

ws.close();};

ws.onclose = function(ev) {};ws.onerror = function() {}; // ?

Page 23: Web browsers & the realtime web
Page 24: Web browsers & the realtime web

What can we use now?HTTP Polling √ß

HTTP Long­Polling √ß

HTTP Streaming √HTML5 WebSockets √*

* ­ See next slide

ß ­ Boo!

Also checkout: http://html5please.us | http://caniuse.com | http://html5readiness.com

Page 25: Web browsers & the realtime web

WebSocket Support

Can use on IE6, IE7, IE8, IE9 and other oldermainstream browsers with web­socket­js Polyfil

Can use on Android with FlashLite or usingFirefox for Android and probably Chrome forAndroid.

Source: http://caniuse.com

Page 26: Web browsers & the realtime web
Page 27: Web browsers & the realtime web

How is thistechnology being

used now?

Page 28: Web browsers & the realtime web

Realtime dataSports, Finance, betting, grids etc.

Page 29: Web browsers & the realtime web
Page 30: Web browsers & the realtime web

NotificationsAlerts or systemevents e.g. long runningprocess has completed (asyncweb).

Realtime comments

Activity streams

Live blogging

Page 31: Web browsers & the realtime web

ChatProbably the No.1 use case

Page 32: Web browsers & the realtime web

CollaborationDocument collaboration and synchronisation

Page 33: Web browsers & the realtime web
Page 34: Web browsers & the realtime web

Social TV2nd screen experiences, 2­Screen, Sit forwardTV

Page 35: Web browsers & the realtime web
Page 36: Web browsers & the realtime web

Multiplayer GamesGame actions

Player/object moves, etc

Game state changes

Page 37: Web browsers & the realtime web

WordSquared

Page 38: Web browsers & the realtime web

WordSquared (Map)

Page 39: Web browsers & the realtime web
Page 40: Web browsers & the realtime web

Iso City

Page 41: Web browsers & the realtime web

Built on Isogenic Engine

Page 42: Web browsers & the realtime web

Free Civ

Not available anymore ­ don't know why

Page 43: Web browsers & the realtime web
Page 44: Web browsers & the realtime web

Rawkets

Page 45: Web browsers & the realtime web

Built by Rob Hawkes: Technology Evangelist at Mozilla.

Page 46: Web browsers & the realtime web

Sierra Games

Page 47: Web browsers & the realtime web
Page 48: Web browsers & the realtime web

TechnologiesSelf Hosted:

socket.io ­ node.js

SockJS ­ Client library with multiple server options(node.js/erlang/lua/python)

FAYE ­ node.js/ruby

XSockets ­ .NET

PHP developer? No chance! Well, there are a few options.

Hosted (platform agnostic)Pusher

There might be others :o)

Full Guide here:http://www.leggetter.co.uk/real­time­web­technologies­guide

Page 49: Web browsers & the realtime web

The future of Realtime Webtechnology

WebSocketsFull native browser support

Not just web browsers

UX considerations

Performance considerations

WebHooksWe still live in a HTTP World

Realtime server to server communication

Page 50: Web browsers & the realtime web

The Internet of Things

Page 51: Web browsers & the realtime web

Arduino's taking over theWorld!

Page 52: Web browsers & the realtime web
Page 53: Web browsers & the realtime web

Questions?/ThanksI'm putting together a realtime web workshop. Ifyou are interested in attending please give me ashout.

Pusher (@pusher) are hiringhttp://pusher.com/jobs

Mobile Evangelist, Developer Evangelist, Engineer,Head of Ops

Phil Leggetter, @leggetter