|Web sockets are an alternative to Ajax, Comet, and Flash for an interactive user experience and RIAs. The web sockets specification is an HTML5 initiative. |
The intent of the web socket standard is to make bi-directional web communication simpler and more efficient.
Among others, Google's Ian Hickson is working on an internet-draft of the the Web Socket Protocol. Following is the abstract of the internet-draft of The Web Socket Protocol:
The Web Sockets protocol enables two-way communication between a user agent running untrusted code running in a controlled environment to a remote host that has opted-in to communications from that code. The security model used for this is the Origin-based security model commonly used by Web browsers. The protocol consists of an initial handshake followed by basic message framing, layered over TCP. The goal of this technology is to provide a mechanism for browser-based applications that need two-way communication with servers that does not rely on opening multiple HTTP connections (e.g. using XMLHttpRequest or iframes and long polling).
The anticipated advantages of web sockets over the use of Ajax or Comet are:
- Single Connection -- Ajax and Comet are not native to the browser so they must rely on maintaining two connections (e.g., an upstream connection and a downstream connection) to stream data to and from the browser. Web sockets support upstream and downstream communications over a single connection.
- Less Load- Expect less of a burden on hardware since the equivalent Ajaxy user experience served up from a web server will support twice the number of single connections.
- Roadblock Clearing -- Web sockets provides the ability to traverse firewalls and proxies so that streaming is possible over any connection.
- Efficient Streaming -- Web sockets supports streaming over HTTP, while alternate solutions use long-polling with the associated overhead.
Google Chrome, version 184.108.40.206 or higher, has web sockets enabled. To experiment, you will need the Dev Channel download of the Chrome browser.
- Web Socket API
- First implementations of Web Sockets
- Web Sockets Now Available In Google Chrome
- Comet is Dead Long Live Websockets - Programming luminary Joe Armstrong (Programming Erlang) shows how he was able to make Erlang talk to a web page, rendered in Chrome, using asynchronous message passing.