codecamp iasi-26 nov 2011 - html 5 websockets
DESCRIPTION
http://codecamp.ro/post/2011/12/02/Codecamp-de-toamna-la-Iasi-2011-dupa-eveniment.aspxTRANSCRIPT
html 5 websocketsFlorin Cardașim, twitter.com/@cardasimEndava
26 nov 2011
Agenda
Real-time web
Demo: long polling
SSE, WebSockets
Demo: WebSockets in Windows 8, ASP.NET & WCF 4.5
Q&A
How do we implement real-time web?
periodic ajax pollingcomet/long polling/http streaming …
flash/javafx/silverlight
html5 server-sent eventshtml5 web sockets
Pollingconnectno messageconnectno message
eventconnectevent
Browser Server
connectno messageconnectno message
eventconnectevent
Polling
No real-time user experienceWasted bandwidth, most requests return no data
Frequent polling determine high server loads
Comet/long polling
connect
eventevent
Browser Server
event
wait
connectwait
eventconnect
wait
Comet/long polling
Real-time user experience
High number of clients determines high pressure on bandwidth, memory, threads/processes
DEMO
Html5 server-sent eventsopen event stream
eventevent
Browser Server
event
Open
HTTP co
nn
ectio
n
event
eventevent
<EventSource>
onmessageonmessageonmessage
Html5 server-sent events
Simulates a server push channel over HTTP
Unidirectional, from server to browserStandardizes some form of Comet/http streaming
New html tag: <EventSource>New mime type: text/event-stream
Html5 WebSocketsClient/Browser
ServerGET /text HTTP/1.1Upgrade: WebSocket Connection: UpgradeHost: www.websocket.org ...
HTTP/1.1 101 WebSocket Protocol HandshakeUpgrade: WebSocket ...
TCP comm channel
Full duplex, bidirectional
Html5 WebSocketsFull duplex, bidirectionalSingle TCP socketStandard ports: http/80, https/443Bandwidth savingsHigher scalability comparing with CometIn&outside of browser
IETF WebSockets Communication protocol
W3C WebSockets API
Server side supportSocket.IO (node.js) Jetty (Java)Ruby/EventMachinePython/TwistedWindows 8, IIS 8, ASP.NET-WCF 4.5
… others
Socket.IO FallbacksAdobe Flash Socket
AJAX Long PollingAJAX Multipart Streaming
Forever iFrame JSONP Polling
http://socket.io/
Browser support
DEMO: WebSockets @Microsoft
ASP.NET 4.5WCF 4.5
Windows 8 Developer PreviewIIS 8ASP.NET 4.5WCF 4.5IE 10, Chrome
WebSockets @Microsoft
http.sys
IIS (iiswsock.dll)
ASP.NET HTTP Pipeline
System.Net.WebSockets
HttpListener
WCF WebSocket transport
WCF high level abstractions
Your code!
ASP.NET high level abstractions
Referenceswww.websocket.orgwww.paulbatum.com www.kaazing.me www.html5labs.com www.buildwindows.com www.google.com/search?q=websocket
Q&A
Please fill your evaluation form
Thank you!
Florin Cardașim, twitter.com/@cardasim Endava26 nov 2011