March 06, 2006

Comet - event driven Ajax arrives

Ajaxian post introduces the name 'Comet' to describe an event-driven approach which is a natural evolution of Ajax applications. It's been great to see so many applications use Ajax and the recent appearance of 'unsolicited message delivery' to browsers is also very cool. There have been a few groups doing this for many years, and it's exciting to see it all about to really take off and become fully mainstream.

The remaining technical hurdle for this technology is the client-side 2 connection limit - at KnowNow we used a 'journal' topic to funnel all messages through, but I don't know what others are doing. I'm going to guess that browsers will soon move this to 4 or more connections. It may be necessary for some deep thinkers to analyze the TCP/IP issues and address it at the protocol level, but I hope not.

Just the other week, I built a simple servlet at work that delivers messages into a browser using a persistent connection. I hooked the servlet to our recruiting/resume pipeline, so now my team gets live notifications the moment a candidate is entered into the system - we now beat out other groups in tagging the candidate and get first choice of many more people. A simple tool, but super useful and it only took a few hours of work, compared to a few weeks of work back at KnowNow so many years ago. Having a built-in XML parser on the client and a robust browser (Firefox in my case) takes care of most of the client infrastructure.

The thing I like about my simple messaging server and client is that it uses hyperlinks identify the set of messages and the client simply 'follows the links' to get more messages. When a client gets to the end of the list of messages, the servlet holds onto that request until more messages arrive - at which point they flow down to the client, achieving fairly low latency. The implementation isn't scalable or efficient, but the approach of using hyperlinks is.

Here's an example chat app (don't expect greatness...)

1 comment:

Gizmo said...

I was a javascript/DHTML or as today called AJAX a very long time and I found another way to work around the cancer factor as I call it (javascript development). I call it WebGui and it is my new development environment it is basically WinForms like API combined with a AJAX unique communication layer making it possible to create complex applications like "Outlook Web Access" as simple as creating a WinForms application...

See my webcast here