OpenSource For You

Enter Websockets

-

Websockets aren't raw system sockets. Rather, they're implemente­d as a special extension on top of HTTP (think of extensions like WEBDAV and the like). When you open a Websocket, it goes through a HTTP handshake—so you can use normal HTTP connection-establishi­ng methods such as authentica­tion or SSL. But after the handshake is over, what you're left with is a perpetuall­y open connection, where you can pump in and receive any data you like. It doesn't even have to have a schema.

In short, this means that you can use it just like a pure network socket.

Websockets are actually the bleeding-edge part of the upcoming set of Web standards. As such, it was only finalised as RFC 6455 as recently as December 2011. It did exist as a number of drafts before. In fact, one such version, Draft 76, was the standard for quite some time, until a gaping security hole was discovered.

With the standard being just two months old, precious few browsers support it. Mozilla Firefox, for one, requires a “Moz” prefix (this should hopefully change with Firefox 11). Chrome has been supporting it since 14.0, but surprising­ly, Safari supports only the earlier plagued Draft 76 version of the protocol, as does Opera. And needless to say, Internet Explorer doesn't support any version of Websockets. This is slated to change with Windows 8, because the Internet Explorer 10 Technology Preview already includes support for Websockets.

This is all very well, but how on earth am I supposed to use it? Well, I hope you know Python.

Newspapers in English

Newspapers from India