Sunday, March 21, 2010

Naively Simple, and Very Powerful: WebSockets!

I don't know how I have managed to miss the next "Simple Big Thing", but I noticed that something called WebSockets has been around for months. And yet I only now bumped into (via announcement for Jetty 8, which boasts support for Servlet 3 API as well as WebSockets). Better late than never I guess.

The idea with WS is very simple, and even somewhat elegant: start up with a regular HTTP connect with hand shake, and then convert it to what amounts to a socket. And use simple properties of UTF-8 encoding to provide simple and inexpensive framing mechanism. Start and end markers used are bytes 0x00 and 0xFF which can not be included in UTF-8 encoded textual data (along with couple of other bytes); and this mostly guarantees that you can nicely included structured textual data using XML or JSON. In fact, elegance of the solution reminds me of UTF-8 encoding which also is surprisingly well designed and simple. In fact, ability of WebSockets to do what it is doing is yet another testament for pure goodness of UTF-8 encoding.

Anyway, this is just a heads up, just in case some of you may have missed this important development. Believe me, this is going to be a big thing very soon. Comet begone; WebSockets is the way forward for efficient low-latency stateful interaction!

blog comments powered by Disqus

Sponsored By

Related Blogs

(by Author (topics))

Powered By

About me

  • I am known as Cowtowncoder
  • Contact me
Check my profile to learn more.