Like most web developers, I saw the Google Wave video and thought about how I could integrate that with my site. Since I have a traditional forum, I thought that the instant rich media would be perfect and almost easy to integrate. I ignored warnings from other popular figures like Ray Ozzie calling it too complex or anti-web. (Especially the latter since Wave should complement the standard RESTful experience, not replace it.)
Oh boy was I wrong.
At the very core of Wave is the “Wave Federation Protocol”, designed for server to server communication, which is actually very simple: a (lower-case) wave has multiple wavelets which are individual XML documents that are constantly mutated in real time. If somebody adds a character or deletes a line, it does so inside the construct of this XML document. When a mutation happens, such as a simple key press, the server must send a skip command to place the “virtual cursor”, and then the key(s) pressed to modify the document to the receiving server.
(upper-case) Wave is Google’s implementation of the wave protocol for real-time collaborative messages. It creates a new wavelet (XML Document) and apparently controls the mutations over Javascript. My plans for a Wave-like forum experience was crushed by the large complexity of Wave over Javascript.
My gung-ho/cowboy style got me pretty far, check out the video: http://twitvid.io/aba4
It’s possibly a story of bad design decisions, but I decided to use something similar to the server to server protocol. I even wrote an XMPP over BOSH server, which was fairly trivial to do. It was nice and simple until I got to the actual typing part: It’s impossible for a simple “textbox” Wave over Javascript. To get my demo working, I had to manually parse over “onKeyPress” or “onKeyUp” events. In addition, I couldn’t find a way to store the document in a Wave friendly format. The “skip” command is just a letter skip with an XML element counting as one character. Wave supports no DOM searching and I had to just do a depth-first search on the XML DOM to both find and place a cursor based on it’s skip value.
I persevered for two weeks until I finally got to a point where I could test the live stuff by opening up Firefox, which itself had issues with my hacked up Javascript just trying to get it to work in Safari. I could barely get the enter key working. And it’s at this point that I decided to give up. The wave protocol might seem easy and makes sense on the outside, but to get the live collaborative editing on Javascript is a whole other issue. It took me 915 lines of Ruby and 725 lines of Javascript just to get to that video demo.
Google has hinted that they’ll provide libraries for Wave, but I don’t think I will use them. Wave is far too complex for me to spend two weeks, full-time, on a simple private message system. For those that want simple blog comments, the embed API looks nice enough to use. If you want to own your data and drop-in on an existing system, look elsewhere because Wave is far too complex for a one man team.