Websockets - OMG! Someone broke the internet!
-
Upload
james-lewis -
Category
Documents
-
view
2.581 -
download
0
description
Transcript of Websockets - OMG! Someone broke the internet!
![Page 1: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/1.jpg)
OMG! Someone broke the internet!James Lewis
Monday, 24 May 2010
![Page 2: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/2.jpg)
• Introductions
• So what are Websockets then?
• Interactions on the World Wide Web
• Implications for building application
• Recap
Monday, 24 May 2010
![Page 3: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/3.jpg)
Monday, 24 May 2010
![Page 4: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/4.jpg)
Developer
XP Coach
Sometime architect
James Lewis
Monday, 24 May 2010
![Page 5: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/5.jpg)
201020001990
A brief history of push to the browser
Monday, 24 May 2010
![Page 6: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/6.jpg)
201020001990
late ’80’s...Al Gore invents the interweb
A brief history of push to the browser
Monday, 24 May 2010
![Page 7: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/7.jpg)
201020001990
1995...Push inventedmultipart/x-mixed-replace
A brief history of push to the browser
Monday, 24 May 2010
![Page 8: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/8.jpg)
201020001990
1996...MS start using pushXMLHTTP
A brief history of push to the browser
Monday, 24 May 2010
![Page 9: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/9.jpg)
201020001990
~2003...MozillaXHR
A brief history of push to the browser
Monday, 24 May 2010
![Page 10: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/10.jpg)
201020001990
2006...The term COMET is coined
A brief history of push to the browser
Monday, 24 May 2010
![Page 11: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/11.jpg)
201020001990
2008...HTML 5 (draft)
A brief history of push to the browser
Monday, 24 May 2010
![Page 12: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/12.jpg)
201020001990
Dec 2009...Chrome build 4.0.249.0Websocket support added
A brief history of push to the browser
Monday, 24 May 2010
![Page 13: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/13.jpg)
201020001990
A brief history of push to the browser
Monday, 24 May 2010
![Page 14: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/14.jpg)
An ExampleGrid computing
Monday, 24 May 2010
![Page 15: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/15.jpg)
An ExampleGrid computing
What do you need to create a grid?
Monday, 24 May 2010
![Page 16: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/16.jpg)
An ExampleGrid computing
Clients that are capable of exectuting arbitrary algorithms
What do you need to create a grid?
Monday, 24 May 2010
![Page 17: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/17.jpg)
An ExampleGrid computing
Clients that are capable of exectuting arbitrary algorithms
A co-ordinating service to push code / data to clients and assemble the results
What do you need to create a grid?
Monday, 24 May 2010
![Page 18: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/18.jpg)
Monday, 24 May 2010
![Page 19: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/19.jpg)
Monday, 24 May 2010
![Page 20: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/20.jpg)
OS
JVM
app
client - server
Anatomy of a traditional grid client
Monday, 24 May 2010
![Page 21: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/21.jpg)
OS
JVM
app
client - server
<Publisher> A co-ordinating service to push code / data and assemble the results
Anatomy of a traditional grid client
Monday, 24 May 2010
![Page 22: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/22.jpg)
OS
JVM
app
client - server
<Listener>
<Publisher>
Clients that are capable of exectuting arbitrary algorithms
A co-ordinating service to push code / data and assemble the results
Anatomy of a traditional grid client
Monday, 24 May 2010
![Page 23: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/23.jpg)
Monday, 24 May 2010
![Page 24: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/24.jpg)
SKYNET
Monday, 24 May 2010
![Page 25: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/25.jpg)
SKYNETSKYNETwe-run-any-code.com
Monday, 24 May 2010
![Page 26: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/26.jpg)
How does we-run-any-code.com work?
Monday, 24 May 2010
![Page 27: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/27.jpg)
How does we-run-any-code.com work?
Well, it doesn’t at the moment...
Monday, 24 May 2010
![Page 28: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/28.jpg)
How does we-run-any-code.com work?
Well, it doesn’t at the moment...
But if it did...
Monday, 24 May 2010
![Page 29: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/29.jpg)
OS
JVM
app
client - server
<Listener>
<Publisher>
Monday, 24 May 2010
![Page 30: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/30.jpg)
OS
JVM
app
client - server
<Listener>
<Publisher>
Browser
js engine
app
we-run-any-code.com
Monday, 24 May 2010
![Page 31: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/31.jpg)
OS
JVM
app
client - server
<Listener>
<Publisher>
Browser
js engine
app
we-run-any-code.com
Map
Monday, 24 May 2010
![Page 32: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/32.jpg)
OS
JVM
app
client - server
<Listener>
<Publisher>
Browser
js engine
app
we-run-any-code.com
Map
Reduce
Monday, 24 May 2010
![Page 33: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/33.jpg)
What do you need to create a grid?
Monday, 24 May 2010
![Page 34: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/34.jpg)
Execute arbitrary code
Co-ordinating service
Push code to client
What do you need to create a grid?
Monday, 24 May 2010
![Page 35: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/35.jpg)
eval(string)Execute arbitrary code
Co-ordinating service
Push code to client
What do you need to create a grid?
Monday, 24 May 2010
![Page 36: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/36.jpg)
eval(string)
Umm, a web server?
Execute arbitrary code
Co-ordinating service
Push code to client Any ideas?
What do you need to create a grid?
Monday, 24 May 2010
![Page 37: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/37.jpg)
“The HTML5 initiative introduced the Web Socket interface -- now developed as an independent specification -- which defines a full-duplex communications channel that operates over a single socket and is exposed via a JavaScript interface in compliant browsers. “Source: websockets.org
Monday, 24 May 2010
![Page 38: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/38.jpg)
[Constructor(in DOMString url, in optional DOMString protocol)]interface WebSocket {
<snip>
// networking attribute Function onopen; attribute Function onmessage; attribute Function onerror; attribute Function onclose; boolean send(in DOMString data); void close();};<snip>
Monday, 24 May 2010
![Page 39: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/39.jpg)
WebsocketsInteractions on the World Wide Web
Monday, 24 May 2010
![Page 40: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/40.jpg)
WebsocketsInteractions on the World Wide Web
GET /nextJob HTTP/1.1Host: werunanycode.comConnection: UpgradeUpgrade: WebSocket
Monday, 24 May 2010
![Page 41: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/41.jpg)
HTTP/1.1 101 WebSocket Protocol HandshakeUpgrade: WebSocketConnection: Upgrade
WebsocketsInteractions on the World Wide Web
GET /nextJob HTTP/1.1Host: werunanycode.comConnection: UpgradeUpgrade: WebSocket
Monday, 24 May 2010
![Page 42: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/42.jpg)
WebsocketsInteractions on the World Wide Web
Monday, 24 May 2010
![Page 43: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/43.jpg)
WebsocketsInteractions on the World Wide Web
websocket: function(url, s) {<snip>
$(ws) .bind('open', $.websocketSettings.open) .bind('close', $.websocketSettings.close) .bind('message', $.websocketSettings.message) .bind('message', function(e){ var m = $.evalJSON(e.originalEvent.data); var h = $.websocketSettings.events[m.type]; if (h) h.call(this, m); }); <snip> }
Monday, 24 May 2010
![Page 44: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/44.jpg)
WebsocketsInteractions on the World Wide Web
public class ClientMessageCallback implements WebSocket {
private Outbound outbound;
public void onConnect(Outbound outbound) { }
public void onDisconnect() { }
public void sendMessage(String message) { try { outbound.sendMessage(message); } catch (IOException e) { throw new RuntimeException(e); } }}
Monday, 24 May 2010
![Page 45: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/45.jpg)
WebsocketsInteractions on the World Wide Web
Monday, 24 May 2010
![Page 46: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/46.jpg)
WebsocketsInteractions on the World Wide Web
Monday, 24 May 2010
![Page 47: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/47.jpg)
WebsocketsInteractions on the World Wide Web
{"type":"message", "data": {"algo":"2+2"}}
Monday, 24 May 2010
![Page 48: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/48.jpg)
WebsocketsInteractions on the World Wide Web
{"type":"message", "data": {"algo":"2+2"}}
Monday, 24 May 2010
![Page 49: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/49.jpg)
WebsocketsInteractions on the World Wide Web
{"type":"message", "data": {"algo":"2+2"}}
{"type":"answer", "data": "4"}
Monday, 24 May 2010
![Page 50: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/50.jpg)
WebsocketsInteractions on the World Wide Web
{"type":"message", "data": {"algo":"2+2"}}
{"type":"answer", "data": "4"}
Monday, 24 May 2010
![Page 51: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/51.jpg)
What did we just see?
Monday, 24 May 2010
![Page 52: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/52.jpg)
What did we just see?
Raw TCP/IP based sockets
Monday, 24 May 2010
![Page 53: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/53.jpg)
What did we just see?
Raw TCP/IP based sockets
Message exchange
Monday, 24 May 2010
![Page 54: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/54.jpg)
What did we just see?
Raw TCP/IP based sockets
Message exchange
State transition logic in the client
Monday, 24 May 2010
![Page 55: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/55.jpg)
What did we just see?
Raw TCP/IP based sockets
Message exchange
State transition logic in the client
The building blocks of the World Wide Web
Monday, 24 May 2010
![Page 56: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/56.jpg)
What did we just see?
Raw TCP/IP based sockets
Message exchange
State transition logic in the client
The building blocks of the World Wide Webthick clien
ts
^the World Wide Web
Monday, 24 May 2010
![Page 57: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/57.jpg)
OS
JVM
app
Browser
js engine
app<Listener>
<Publisher>
<Listener>
<Publisher>
See? It’s a thick client!
Monday, 24 May 2010
![Page 58: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/58.jpg)
But that doesn’t break the internet does it?
Monday, 24 May 2010
![Page 59: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/59.jpg)
But that doesn’t break the internet does it?
well, what is the internet?
Monday, 24 May 2010
![Page 60: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/60.jpg)
Monday, 24 May 2010
![Page 61: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/61.jpg)
Monday, 24 May 2010
![Page 62: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/62.jpg)
Characteristics of the interwebernet
identification of resources
manipulation of resources through representations
self-descriptive messages
HATEOAS
Source: Fielding, Roy. 2000. Architectural Styles and the Design of Network-based Software Architectures. PhD diss
layered system
Monday, 24 May 2010
![Page 63: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/63.jpg)
Image of ISP Backbone Connectivity reflecting Skitter Path Data - 1998 http://www.caida.org/Tools/Skitter/viz9808.html
Monday, 24 May 2010
![Page 64: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/64.jpg)
Feature #1- scalability
Monday, 24 May 2010
![Page 65: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/65.jpg)
Feature #1- scalability“The internet trades latency for scalability”Dr Jim Webber
Monday, 24 May 2010
![Page 66: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/66.jpg)
Feature #1- scalability“The internet trades latency for scalability”
“Push trades scalability for latency”
Dr Jim Webber
Monday, 24 May 2010
![Page 67: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/67.jpg)
Feature #1- scalability“The internet trades latency for scalability”
“Push trades scalability for latency”
Dr Jim Webber
Me
Monday, 24 May 2010
![Page 68: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/68.jpg)
This may suprise you but the web doesn’t look like thisMonday, 24 May 2010
![Page 69: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/69.jpg)
Monday, 24 May 2010
![Page 70: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/70.jpg)
Monday, 24 May 2010
![Page 71: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/71.jpg)
Client cache
Monday, 24 May 2010
![Page 72: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/72.jpg)
Client cache
Proxy cache
Monday, 24 May 2010
![Page 73: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/73.jpg)
Client cache
Proxy cache CDN
Monday, 24 May 2010
![Page 74: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/74.jpg)
Client cache
Proxy cache CDN Infrastructurecaches
Monday, 24 May 2010
![Page 75: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/75.jpg)
Client cache
Proxy cache CDN Infrastructurecaches
Reverse proxycache
Monday, 24 May 2010
![Page 76: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/76.jpg)
Monday, 24 May 2010
![Page 77: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/77.jpg)
Monday, 24 May 2010
![Page 78: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/78.jpg)
Monday, 24 May 2010
![Page 79: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/79.jpg)
Monday, 24 May 2010
![Page 80: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/80.jpg)
Monday, 24 May 2010
![Page 81: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/81.jpg)
Monday, 24 May 2010
![Page 82: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/82.jpg)
Monday, 24 May 2010
![Page 83: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/83.jpg)
And Websockets?
Monday, 24 May 2010
![Page 84: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/84.jpg)
Monday, 24 May 2010
![Page 85: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/85.jpg)
Monday, 24 May 2010
![Page 86: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/86.jpg)
Monday, 24 May 2010
![Page 87: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/87.jpg)
Feature #2 - availability
Monday, 24 May 2010
![Page 88: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/88.jpg)
Feature #2 - availability“The internet is not a five nines fabric”Urs Hölzle
Monday, 24 May 2010
![Page 89: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/89.jpg)
Feature #2 - availability“The internet is not a five nines fabric”
“If you are going to build an internet scale application using push, you’d better not count on it’s availability”
Urs Hölzle
Monday, 24 May 2010
![Page 90: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/90.jpg)
Feature #2 - availability“The internet is not a five nines fabric”
“If you are going to build an internet scale application using push, you’d better not count on it’s availability”
Urs Hölzle
Me
Monday, 24 May 2010
![Page 91: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/91.jpg)
Monday, 24 May 2010
![Page 92: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/92.jpg)
Pakistan suffers a near complete Internet outage as a submarine cable becomes defective (Jun)
2005
Monday, 24 May 2010
![Page 93: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/93.jpg)
The Middle East, India, and other parts of Africa and Asia see a major degradation in Internet service, including outages, after several undersea cables carrying Internet traffic to the region are cut within 1 week (Jan-Feb)
2008
YouTube becomes unreacheable for a couple of hours after Pakistan Telecom starts an unauthorized announcement of YouTube's subnet prefix (24 Feb)
Source: Hobbes' Internet Timeline, www.zakon.org/robert/internet/timeline/
Pakistan suffers a near complete Internet outage as a submarine cable becomes defective (Jun)
2005
Monday, 24 May 2010
![Page 94: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/94.jpg)
Corus steel works, the Netherlands - ANP
Monday, 24 May 2010
![Page 95: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/95.jpg)
Other stuff you will need to think about
Monday, 24 May 2010
![Page 96: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/96.jpg)
Other stuff you will need to think about
Testing
Monday, 24 May 2010
![Page 97: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/97.jpg)
Other stuff you will need to think about
Testing
Coupling
Monday, 24 May 2010
![Page 98: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/98.jpg)
Other stuff you will need to think about
Testing
Coupling
Domain models
Monday, 24 May 2010
![Page 99: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/99.jpg)
How do you normally test webapps?
...<div id=”algorithm”>
<span>var x = [crazy complex prime stuff]</span>
<form action=”/jobs/asd2b234c598/answer” method=”POST”><input type=”text” name=”answer” value=”” />
</form></div>...
Monday, 24 May 2010
![Page 100: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/100.jpg)
How do you normally test webapps?
...<div id=”algorithm”>
<span>var x = [crazy complex prime stuff]</span>
<form action=”/jobs/asd2b234c598/answer” method=”POST”><input type=”text” name=”answer” value=”” />
</form></div>...
acceptance tests
integration tests
functional tests
unit tests
Monday, 24 May 2010
![Page 101: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/101.jpg)
But now the logic is in both client and server
acceptance tests
integration tests
functional tests
unit tests
Monday, 24 May 2010
![Page 102: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/102.jpg)
But now the logic is in both client and server
acceptance tests
integration tests
functional tests
unit tests
acceptance tests
integration tests
functional tests
unit tests
Monday, 24 May 2010
![Page 103: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/103.jpg)
But now the logic is in both client and server
acceptance tests
integration tests
functional tests
unit tests
acceptance tests
integration tests
functional tests
unit tests
You don’t suck, so you are going to test both right?
Monday, 24 May 2010
![Page 104: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/104.jpg)
And the asynchronous stuff? You’re pretty good at testing multi-threaded
code are you?
Monday, 24 May 2010
![Page 105: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/105.jpg)
And the asynchronous stuff? You’re pretty good at testing multi-threaded
code are you?
Dan North and James’ first rule of concurrency
Monday, 24 May 2010
![Page 106: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/106.jpg)
And the asynchronous stuff? You’re pretty good at testing multi-threaded
code are you?
Dan North and James’ first rule of concurrency
“Doug Lea does it better than you do...”
Monday, 24 May 2010
![Page 107: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/107.jpg)
Recap
Monday, 24 May 2010
![Page 108: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/108.jpg)
Websockets are really cool!
Recap
Monday, 24 May 2010
![Page 109: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/109.jpg)
Websockets are really cool!And simple to use
Recap
Monday, 24 May 2010
![Page 110: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/110.jpg)
Websockets are really cool!And simple to use
Recap
http://code.google.com/p/jquery-websocket/
http://jetty.codehaus.org/jetty/
http://www.google.com/chrome
Monday, 24 May 2010
![Page 111: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/111.jpg)
Recap
Monday, 24 May 2010
![Page 112: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/112.jpg)
You can implement some really exciting applications with them
Recap
Monday, 24 May 2010
![Page 113: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/113.jpg)
You can implement some really exciting applications with them
They are particularly well-suited to low-latency stuff
Trading applications for example
Recap
Monday, 24 May 2010
![Page 114: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/114.jpg)
Recap
Monday, 24 May 2010
![Page 115: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/115.jpg)
Recap
But you won’t be able to take advantage of the stuff that makes the internet scale or interoperate
You will have to learn how to do that yourself
Monday, 24 May 2010
![Page 116: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/116.jpg)
Ps we-run-any-code.com is coming...
Monday, 24 May 2010
![Page 117: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/117.jpg)
Welcome back James
SKYNET is active
The current grid size is:
What code would you like to run?
22,107,123
...
>>
>>
>>
>>
Monday, 24 May 2010
![Page 119: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/119.jpg)
Monday, 24 May 2010
![Page 120: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/120.jpg)
A traditional implementation...
we-run-any-code.com
Monday, 24 May 2010
![Page 121: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/121.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
Monday, 24 May 2010
![Page 122: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/122.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
classic HTTP request-response
Monday, 24 May 2010
![Page 123: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/123.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
classic HTTP request-response
Monday, 24 May 2010
![Page 124: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/124.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
Monday, 24 May 2010
![Page 125: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/125.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
Monday, 24 May 2010
![Page 126: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/126.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
Monday, 24 May 2010
![Page 127: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/127.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
GET /index HTTP/1.1Host: we-run-any-code.com
Monday, 24 May 2010
![Page 128: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/128.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
GET /index HTTP/1.1Host: we-run-any-code.com
HTTP/1.1 200 OK
<html>...
<a rel=”nextjob” href=”/nextjob” />...
</html>
Monday, 24 May 2010
![Page 129: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/129.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
Monday, 24 May 2010
![Page 130: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/130.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
GET /nextjob HTTP/1.1Host: we-run-any-code.com
Monday, 24 May 2010
![Page 131: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/131.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
GET /nextjob HTTP/1.1Host: we-run-any-code.com HTTP/1.1 303 See Other
Location: /jobs/asd2b234c598
Monday, 24 May 2010
![Page 132: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/132.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
GET /nextjob HTTP/1.1Host: we-run-any-code.com HTTP/1.1 303 See Other
Location: /jobs/asd2b234c598
GET /jobs/asd2b234c598 HTTP/1.1Host: we-run-any-code.com
Monday, 24 May 2010
![Page 133: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/133.jpg)
Traditional we-run-any-code.comInteractions on the World Wide Web
GET /nextjob HTTP/1.1Host: we-run-any-code.com HTTP/1.1 303 See Other
Location: /jobs/asd2b234c598
...<div id=”algorithm”>
<span>var x = [crazy complex prime stuff]</span>
<form action=”/jobs/asd2b234c598/answer” method=”POST”><input type=”text” name=”answer” value=”” />
</form></div>...
GET /jobs/asd2b234c598 HTTP/1.1Host: we-run-any-code.com
HTTP/1.1 200 OK
Monday, 24 May 2010
![Page 134: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/134.jpg)
What did we just see?
HTTP verbs and status codes
Addressable resources
HATEOAS
This is how the internet has been able to grow to, umm, internet-scale...
Monday, 24 May 2010
![Page 135: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/135.jpg)
Closed set of operations, well-understood semantics
GET <resource-name> HTTP/1.1
PUT <resource-name> HTTP/1.1
POST <resource-name> HTTP/1.1
DELETE <resource-name> HTTP/1.1
OPTIONS <resource-name> HTTP/1.1
HEAD <resource-name> HTTP/1.1
Monday, 24 May 2010
![Page 136: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/136.jpg)
Enables you to go from this:
Monday, 24 May 2010
![Page 137: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/137.jpg)
To this
Monday, 24 May 2010
![Page 138: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/138.jpg)
Representations of resources
Addressable
self-contained
(there’s this thing with media types, but we won’t go into that)
Monday, 24 May 2010
![Page 139: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/139.jpg)
Representations of resources
...<div id=”algorithm”>
<span>var x = [crazy complex prime stuff]</span>
<form action=”/jobs/asd2b234c598/answer” method=”POST”><input type=”text” name=”answer” value=”” />
</form></div>...
Addressable
self-contained
(there’s this thing with media types, but we won’t go into that)
Monday, 24 May 2010
![Page 140: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/140.jpg)
Representations of resources
...<div id=”algorithm”>
<span>var x = [crazy complex prime stuff]</span>
<form action=”/jobs/asd2b234c598/answer” method=”POST”><input type=”text” name=”answer” value=”” />
</form></div>...
HTTP/1.1 303 See OtherLocation: /jobs/asd2b234c598 Addressable
self-contained
(there’s this thing with media types, but we won’t go into that)
Monday, 24 May 2010
![Page 141: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/141.jpg)
Hypermedia As The Engine Of Application State
<html>...
<a rel=”nextjob” href=”/nextjob” />...
</html>
Monday, 24 May 2010
![Page 142: Websockets - OMG! Someone broke the internet!](https://reader034.fdocuments.in/reader034/viewer/2022042714/555a81dfd8b42abb628b4b97/html5/thumbnails/142.jpg)
Hypermedia As The Engine Of Application State
<html>...
<a rel=”nextjob” href=”/nextjob” />...
</html>
Starting Grid
GET Finding job
Running jobSubmitting answer
GET
GET
POST
Monday, 24 May 2010