SlideShare a Scribd company logo
WebSockets On FireHTML5 WebCamps 2011
WhoisJef ClaesFerranti Computer Systems@JefClaeshttp://jclaes.blogspot.comJef.claes@gmail.com
ContentWHY do we need WebSockets?WHATare WebSockets?What is the state ofWebSockets TODAY?So show me some CODE.
ContentWHY do we need WebSockets?WHATare WebSockets?What is the state ofWebSockets TODAY?So show me some CODE.
DIRECT COMMUNICATION between browser and server
Chat applications
Collaborative tools
Socialnetworking
Online gaming
But haven’t we been doingthisfor a while?
COMET
1. Frequent polling
BrowserServerHTTP RequestHTTP Response
GET /PollingStock//PollingStock HTTP/1.1Host: localhost:8080User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: en-usAccept-Encoding: gzip,deflateAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7Keep-Alive: 300Connection: keep-aliveReferer: http://www.example.com/PollingStock/Cookie: showInheritedConstant=false; showInheritedProtectedConstant=false; showInheritedProperty=false; showInheritedProtectedProperty=false; showInheritedMethod=false; showInheritedProtectedMethod=false; showInheritedEvent=false; showInheritedStyle=false; showInheritedEffect=falseHTTP/1.x 200 OKX-Powered-By: Servlet/2.5Server: Sun Java System Application Server 9.1_02Content-Type: text/html;charset=UTF-8
Request / Response headers = 871 bytes1000 clients poll every 10 seconds1000 * 871 bytes = 0,8MB / 10 seconds	0,8 MB * 6 = 4,8 MB / minute	4,8 MB * 60 = 288 MB / hour	288 MB * 24 = 6,912 GB / day
2. Long polling
Waitfor it...BrowserServerHTTP RequestHTTP Response
Say NO to COMET
ContentWHY do we need WebSockets?WHATare WebSockets?What is the state ofWebSockets TODAY?So show me some CODE.
‘TCP for the Web’Full-duplex direct communication
BrowserServerHTTPHTTPWebSocketWebSocket
WebSockets HandshakeGET /demo HTTP/1.1 Upgrade: WebSocketConnection: Upgrade Host: example.com Origin: http://example.com Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5 Sec-WebSocket-Key2: 12998 5 Y3 1 .P00 ^n:ds[4U HTTP/1.1 101 WebSocket Protocol Handshake Upgrade: WebSocketConnection: Upgrade Sec-WebSocket-Origin: http://example.com Sec-WebSocket-Location: ws://example.com/demo Sec-WebSocket-Protocol: sample 8jKS'y:G*Co,Wxa-
WebSockets message0x00 wsMessage0xFF
BenefitsNative implementedLessthroughputPerformanceComplexity
ContentWHY do we need WebSockets?WHATare WebSockets?What is the state ofWebSockets TODAY?So show me some CODE.
1. HTML5Work In Progress
2. Browser supportIE9: NoSafari 5, Chrome 10:YesFireFox 4, Opera 11: Yes, but…Mobile: No, only Safari :-(Source: http://caniuse.com
2. Browser supportALTERNATIVES yesssssSilverlight
Flash3. The serverHTML5 Labs (WCF)	http://html5labs.interoperabilitybridges.com pywebsocket(Apache extension) 	http://code.google.com/p/pywebsocket/jWebSocket (Java)http://jwebsocket.org/web-socket-ruby (Ruby)https://github.com/gimite/web-socket-ruby…
ContentWHY do we need WebSockets?WHATare WebSockets?What is the state ofWebSockets TODAY?So show me some CODE.
Why?Information ASAP
Information screensPagingJIT PrintingWebsitesWhy?
1. NetViewer
2. Current Incidents
SilverlightclientWCF WebSockets ServerDispatcherSilverlightclientSilverlightclienthttp://html5labs.interoperabilitybridges.com/
Code
ConclusionWebSockets > COMETNotquite ready
Recommended resourceshttp://dev.w3.org/html5/websockets/http://html5labs.interoperabilitybridges.comhttp://blogs.msdn.com/b/interoperability/archive/tags/html5/http://jclaes.blogspot.com
Q & A
JoinusTwitter:@MSDNBeluxOur tag today: #webcampbeFacebook: MSDN België (NL)MSDN BeLux (FR)Latestnews on www.msdn.beAlways up to date: register to MSDN Flash and Express Yourselfhttp://www.msdn-newsletters.be
Thankyou

More Related Content

WebSockets On Fire