[The first part of "Comet Story" was the story of failure. This part is no different with a slight twist at the end.]
Forgetting Comet was not such a bad thing actually. In the aftermath, I ended up passing the Zend Certified Engineer exam :-) But after the exam, the itch was back; time and again, I'll start thinking about Comet and online whiteboards. Regarding Comet, I was probably thinking deep inside my mind that a magic solution will appear somehow.
I used it for testing my own video player and played it again and again. I cannot remember enjoying any of my own softwares so much. But then, the fun was in the video content and not in the software. No wonder youtube is so successful with such a simple setup. After all these video powered fun, it was time to roll the sleeves and get down to the real job - the construction of the whiteboard. And here, lady luck disappeared again :-(
Putting up a very basic whiteboard in OpenLaszlo was a piece of cake. It even worked! But after using it for a few minutes, it almost froze! And worst, I could not find why. A long time after that first dash with the whiteboard, I discovered that I was not the only one facing the problem and there was no known solution. Maybe it was some kind of bug in part of OpenLaszlo, but I'll never know. So that was the end of my stint with OpenLaszlo. After reading a whole book, after watching one of the best movie trailers, after contemplating a career in Flash development, I was standing totally empty handed.
While I was doing all these, Jason Kester of Expatriate Software (you should really read their About Us page :) released Twiddla.com which is an online whiteboard based on HTML Canvas. Instead of Comet, it uses polling. Other than this, Twiddla's whiteboard is the nearest to my wish.
My failure with OpenLaszlo convinced me that I'll have to work with the real thing and no Open Source alternative - that is, I'll have to learn ActionScript. As a matter of coincidence, Adobe released their Flex 3 SDK as Open Source around this time (Feb 2008, according to Wikipedia). It took me a while to find this out. So after a hiatus of a few months, I finally gathered enough energy to learn ActionScript at the beginning of 2009. It turned out that ActionScript is well capable of providing a bug free whiteboard and it can also interface with Comet servers. Things started to look really good. But I was seriously short of time to cook up the final meal :-(
In the few months between my move from OpenLaszlo to ActionScript, I have noticed quite a few mention of XMPP in various people's blogs. Their message was that XMPP will soon go big. This is the kind of message you'll hear about all sorts of things in all sorts of blogs from all sorts of people (eating Liquorice allsorts :) . So I didn't pay much heed. But I did start to pay more respect to XMPP although I was never a serious fan of online chatting. Both gmail chat and meebo uses Comet powered chat clients and gmail even uses XMPP as its chat protocol. Maybe these factors played a part to relate XMPP and Comet in my mind.
Then two things happened in Feb, 2009. First a link of Marek Majkowski's Comet powered collaborative text editor popped up in progit (Reddit's programming channel at programming.reddit.com). This editor uses something called the evServer as a Comet server. It is built in Django and routes the updates with RabbitMQ.
While going through blog posts on XMPP, I became aware of this term called "messaging platform". These platforms are a kind of telephone exchange for inter application messaging. Majek's article made me aware of using a messaging platform for passing updates between browsers. The idea works like this:
Now there is an ongoing debate about whether XMPP servers qualify as a messaging platform. Some say XMPP is the future of messaging; others say it is AMQP and not XMPP. RabbitMQ is the most popular AMQP server and ejabberd is the most popular XMPP server. So it's almost a RabbitMQ vs. ejabberd type argument :-) But I knew so little about messaging that I was not bothered at all. My attitude was - I'll use whatever works.
So why did I care so much about the messaging platform? Because they support authentication. They will allow me to send upgrades to only those browsers who are supposed to receive the upgrade. This will prevent intrusion.
At almost the same time, one more link caught my eyes at progit. It was Mihai Sucan's tutorial about building an HTML Canvas based paint application. This tutorial also came with an easy to understand demo application. So I now have the code for a paint application and Strophe for writing Comet applications all backed by a messaging platform. Quite naturally, the next step was to mash these all and fulfil my wish for a Comet powered collaborative whiteboard. I decided to give it a go on the next weekend.
When the weekend at last came, I spent the first few hours following Mihai's tutorial. Nice piece of write up I will say. So the next task was to learn to use Strophe. ejabberd already implements BOSH, so I spent the next few hours fighting to configure it as a BOSH capable XMPP server. No complain here either. Next it was time to run a few test apps that come with Strophe. Quite predictably, none of those worked! Whatever I do, they would not budge :-(
So I was back to square zero again. Unable to use Strophe, I was thinking what to do. Once again, I am not sure why I did what I did next. I pulled a copy of Strophy from its git repo and suddenly the test application worked!!! Prior to this I was trying with the recent stable release of Strophe. That stable release has given me quite an unstabling time.
Now I have all the cards in my hand. I have gathered all I need to know to build the application that I have wished to build for so long. My application will be built with HTML canvas, Strophe, and ejabberd. My joy knew no bounds when the application finally worked after two more days of work. But I'll leave the details of those two days for the next and last part of this series. In the mean time, if you are restless to see what I have actually built, then head on to this place.