ISM APAC TechTalk - WebSockets Presentation

Embed Size (px)

Citation preview

WebSockets

Dimuthu NilankaSoftware DeveloperISM APACISM APAC TechTalks

What is the WebSockets?

WebSocket is...

a new feature introduce with HTML5.

a protocol providing full-duplex communications channels over a single TCP connection.

still being standardized by the W3C.

implemented on Chrome 14, Firefox 6, Safari 6, Opera 12.10, Internet Explorer 10 and above.

Early days of the Internet?

Internet was so boring like this :)Early days of the Internet?

What made the Internet more dynamic?

around 2005 Ajax make it more dynamic.

but it needed user interaction or periodic polling to load new data.

comet was around since 2000 but was not so popular.

around 2006 it's become more popular and used by gmail, AOL, yahoo and Microsoft.

disadvantages and more info about Comet: http://www.ibm.com/developerworks/library/wa-reverseajax1/

Little more details about WebSockets

WebSocket more info...

Client request:

GET /chat HTTP/1.1Host: server.example.comUpgrade: websocketConnection: UpgradeSec-WebSocket-Key: x3JJHMbDL1EzLkh9GBhXDw==Sec-WebSocket-Protocol: chat, superchatSec-WebSocket-Version: 13Origin: http://example.com

Server response:

HTTP/1.1 101 Switching ProtocolsUpgrade: websocketConnection: UpgradeSec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=Sec-WebSocket-Protocol: chat

Has introduce new url scheme ws:// and wss://

Work well with proxies and firewalls

Real world usage of WebSockets

Chat applications

Multi-player online games

Real time tracking and updates

Collaborative editing

A really simple demo

A Mouse tracking demo

Based on Node.js and Socket.IO

Download the demo:https://github.com/dimuthu/websockets-demo.git

Other WebSocket implementations

.NET SuperWebSocket (http://superwebsocket.codeplex.com/)

Java Jetty (http://www.eclipse.org/jetty/)

C++ - libwebsockets (http://git.warmcat.com/cgi-bin/cgit/libwebsockets/)

Python pywebsocket and Tornado (http://code.google.com/p/pywebsocket/ and https://github.com/tornadoweb/tornado)

Questions / any comments ?

References

http://en.wikipedia.org/wiki/WebSocket

http://www.html5rocks.com/en/tutorials/websockets/basics/

http://www.websocket.org/aboutwebsocket.html

http://socket.io/

Thank you!