Chatroom Feature for Drupal 6.x built with Node.js and Backbone.js

Posted October 12, 2011

Recently, for fun and learning, I built a group chatroom feature for Drupal 6.x. I’ve been learning and using Node.js and Backbone.js the past few months and building a chatroom seemed like a great project to stretch my skills.

I’ve recently pronounced it “finished” and the code is available on Github. There are a few obscure bugs left but by and large, it’s plenty stable for those wanting a chatroom on Drupal 6.x.

The feature should work with any site using Spaces and Organic Groups. The demo site I setup, for example, is using a default installation of Open Atrium.

Technology stack

The chatroom is built using a now fairly standard set of technologies. For the backend, I used Node.js, Redis, and MySQL. I used for sending the chat messages between clients and the server. I used Brunch to build the frontend. Brunch bundles together a number of really nice tools for building single-page Javascript apps including Coffeescript, Backbone.js, Underscore.js, Stitch, and Eco.

A few conclusions

Backbone.js rocks. It makes creating highly interactive, responsive interfaces almost trivial while keeping your code neatly organized. It’s a very neat round-up of the best patterns for creating Javascript applications.

Hand-rolling a way to securely connect Drupal and Node.js was a pain—probably the hardest part of building the feature. Use the Node.js Integration module if you’re on Drupal 7.

Redis is really impressive. It has one of the shallowest learning curve of any technology I’ve used. I was up and running with it in perhaps 15 minutes. Add that it’s incredibly fast and you have a very handy tool to add to your toolset.

Note: the demo site that was linked from here is now off-line.

Tagged with drupal | backbone.js | node.js

Subscribe to get updated on new posts!

Kyle's profile picKyle Mathews lives and works in Seattle building useful things. You should follow him on Twitter. Currently exploring what's next and open to consulting.