In association with heise online

10 December 2009, 15:31

First implementations of Web Sockets

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

Ajax has enabled developers to make several improvements to their web applications, but it is not the last word on the matter. Under Ajax all communication is still initiated by the browser. Web Sockets, a proposal by the World Wide Web Consortium (W3C), is intended to offer a true bi-directional connection. Interested users can now experiment with the first implementation of the technology.

Google developers have integrated Web Sockets into the latest developer version of their Chrome browser, something which Mozilla has also been working on since early this year. There is a JavaScript version of the Web Sockets API which requires Flash support in the browser, since it shares the Flash socket. There is also a JavaScript implementation which does the same job, but aims to be browser-independent.

To experiment with Web Sockets, in addition to the browser-side APIs, developers will also need a suitable server. Google has already provided a Python application for the purpose, which can be used either as a stand alone web server or as an Apache module.

Applications which use the Web Sockets API open a permanent connection between the browser and server. As with Ajax, when a message is received by the browser, it triggers an event which is processed by an event handler. One difference from the current technology is that the server can send data over the connection at any time without having been requested to do so by a browser GET or POST request. After an open request, the channel then remains open until an explicit close request is sent.

Rather than using HTTP, Web Sockets uses a new protocol. This should be less garrulous, as after specifying connection parameters it dispenses with the exchange of repetitive headers.


Print Version | Send by email | Permalink:

  • July's Community Calendar

The H Open

The H Security

The H Developer

The H Internet Toolkit