Web sockets is new technology to make real-time web. It gives you ability to perform browser-server conversation in a really fast and effective way.
The Web sockets specification -- developed as part of the HTML5 initiative -- introduced the Web Socket JavaScript interface, which defines a full-duplex single socket connection over which messages can be sent between client and server. The Web Socket standard attempts to simplify much of the complexity around bi-directional web communication and connection management.
Web Sockets represent an alternative to Comet and Ajax. However, each technology has its own unique capabilities. Learn how these technologies vary so you can make the right choice.
GET /demo HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: site.com
Origin: http://site.com
HTTP/1.1 101 Web Socket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
WebSocket-Origin: http://site.com
WebSocket-Location: ws://site.com/demo
Now you have established websocket connection