XMPP Case Study Interview: Cabulous

January 5, 2010

XMPP keeps showing up in new places and new applications. It is amazing that the protocol is so versatile as to be used not only in instant messaging applications, but also in domains like search, gaming, middleware, and social services.

I want to highlight these developers and companies that are building great things with XMPP. This is the first of a series of blog posts where I’ll interview the developers and let them explain their product and how XMPP fits in. I hope you enjoy them! If you have suggestions for future case study posts, please let me know.

Welcome to the first XMPP case study interview, with Elijah Windsor, lead developer of Cabulous.

Cabulous screenshot Cabulous screenshot

:EXTENDED:

Cabulous

Jack: What is Cabulous?

Elijah: Cabulous is a mobile application that gives taxi drivers and their passengers peace of mind by seeing exactly where each other is from hail to pick-up.

Jack: What platforms does Cabulous run on currently? Will it be expanding further?

Elijah: Currently it runs on the iPhone but we’re soon going to be on BlackBerry and Android. Also we’re coming out with a lite version very soon for cab drivers who have a J2ME capable phone.

Jack: Where does XMPP fit in at Cabulous? What is it used for?

Elijah: XMPP is the protocol of choice for Cabulous. We chose this protocol because of it’s flexibility and ease-of-use. When you see cabs moving around on your screen, that’s done through XMPP. When you hail a cab, we use XMPP to let that cab driver know you want a ride.

Jack: Can users chat to the drivers? Are there other social features? Are these all done via XMPP as well?

Elijah: Currently the users can make phone calls to the drivers, but chat is in the plans for the near future. You can set a cabbie as your favorite simply by clicking on the star next to his name. This is done through XMPP as a simple roster entry. Then, later on you can see if he’s online, if he’s available, and where he is simply by clicking on his name in your favorites list.

Jack: Why did you choose XMPP for Cabulous?

Elijah: We wanted to use a protocol that allows for flexibility and scalability. We have experience using services such as polling on HTTP for similar features as Cabulous, but this turned out to be nearly unscalable. XMPP is fast and gets the job done for us and allows us to do more with less.

Jack: Were there alternative technologies that you investigated before choosing XMPP?

Elijah: Yes, one of the main ones we looked at as an alternative was AMQP. But for the most part we were set on XMPP from the beginning.

Jack: Was this your first time working with the XMPP protocol?

Elijah: Yes.

Jack: Did it take you long to get up to speed? What parts excited you? Which parts gave you trouble?

Elijah: It didn’t take too much time compared to other protocols out there. For example with AMQP I would have to shift binary digits, and I didn’t want to do that. The good thing about XMPP is it’s XML so it’s very readable.

There are many books on XMPP and I chose one of the ones on O’Reilly’s Safari. It helps me a great deal breaking down the 3 main types of packets that are sent on XMPP.

(The book Elijah references here is XMPP: The Definitive Guide.)

One bit that caused a little trouble was finding the most reliable XMPP server. We went with Erlang’s ejabberd and the hard part was learning Erlang. However now that that part’s done with I am glad we went with this server, and also might I add that Erlang is an awesome language, and I’m glad we’re where we are using it.

Jack: Was there anything that XMPP made simpler than it would otherwise be in Cabulous?

Elijah: Well for one, we didn’t have to create our own system. XMPP already existed and was well defined before we came up with our idea. And also we enjoy seeing XML packets as they’re a lot more readable than some other methods. That alone helped us out a great deal, and another thing that helped us out a lot (and will help us out a lot in the near future!) is scalability.

Jack: Did you need to define any custom protocols for your applicatoin, or did everything map into existing ones?

Elijah: Well, we understand that XMPP has been out for years and has been tailored mainly to PCs over reliable Internet connections. That being said we, had to define several custom protocols (within XMPP standard packet types) in order to accomodate the mobile network’s limitations

We wanted our stuff to be fast and as close to one-step as it could be for usability’s sake. So on some of our protocols we simply took the existing XMPP ones and trimmed them down a bit.

Jack: Can you give an example of this?

Elijah: One example is the roster. The standard XMPP example has us adding a user to our roster, and then the user verifying that it’s okay for us to see their online status, and then the user who added the user can see their friends online status. We needed this to be a one-step process as our situation is a bit different from a chatting program - having cabbies verify passengers as OK to see them wouldn’t make sense, since cabbies want to be seen (and hailed!)

So we had to trim down the roster specification and ended up making adding to to a roster a one-way, instant process. Once you add someone, you can see their online status and their location.

Jack: I assume you implemented this with custom ejabberd modules? Or did you modify the existing roster module to suit your needs?

Elijah: Custom ejabberd modules, yes.

Jack: That’s a pretty major customization of XMPP logic. Was this difficult to do?

Elijah: It was difficult at first because of the limited resources about ejabberd modules. But once I got it to hook in right and was comfortable with Erlang, it became easier. A major strength here of XMPP is that it’s easy to read, so I didn’t have to worry about shifting bits around or anything like that.

Jack: Will you be using or recommending XMPP again in future projects?

Elijah: Definitely. We will continue to expand upon our current set of features for Cabulous and definitely use this for other location-based social apps we create.

Technical Details

Cabulous is a custom XMPP client. The current version is written in Objective-C and uses the XMPPFramework library.

The XMPP server used is ejabberd, and the XMPP back-end consists a mixture of normal ejabberd modules and some custom, Cabulous-specific modules.

As a side note for Erlang fans, the web back-end for Cabulous is built on top of BeepBeep and MochiWeb and communicates with the ejabberd server.

Elijah said that the social features of Cabulous mapped quite well onto the standard roster functionality. The location information and updates are implemented as a pubsub-like custom protocol that leverage <presence> stanzas.

My Thoughts

It’s very cool to know that I can hail a cab with XMPP technology, but most users do not care what powers the application. In this case, XMPP is invisible to the end user. Those users will notice the instantaneous updates they get and the social features XMPP has enabled within the application.

You can download Cabulous today from iTunes; it’s a free application. I believe they’ve mostly been concentrating on cabs in the San Francisco Bay area, but any cab driver can sign up and start using it.

I wish Elijah and his team much luck with their application and their further XMPP adventures!

XMPP Case Study Interview: Cabulous - January 5, 2010 - Jack Moffitt