Every two weeks we spread the word of Node.js and the cool and incredible things it can do. We do that by profiling creative, interesting and fun uses of Node.js in various products and projects. We call it “In the Loop.”
Holler.js by Paul Bouchon is a real-time notification service. It’s distributed as a Node module with client-side code that builds on alertifyjs. As for Paul himself, he provided some background to help understand him better:
Now that we know more about Paul, let’s talk to him about Holler.js.
Paul Bouchon: Holler.js started as a late night experiment with Node.js and cometD. I was working on a website that relied very heavily on user input and live data, so I thought it made sense to implement a real-time alerting system. Pushing stuff from server to client has been done for a long time, so I knew it was most definitely possible; it was just a matter of putting the pieces together in a way that was sane and minimal.
What made you decide to create this using Node.js? What’s your background with Node.js?
Paul Bouchon: I’ve worked with the Bayeux protocol in the past as a developer on the Open Cooperative Web project, so I was definitely predisposed in favor of cometD. I’d been using Node.js as my go-to web server more and more; its speed, simplicity, and package management make it the perfect server for my needs, and its community is as active as ever.
Still, I hadn’t really used Node for anything more than routing and rendering templates, and I was eager to do so. After digging around the interwebs, I was happy to see such actively maintained and mature projects as Faye. It was distributed as an npm package, and I was already using Alertify locally on the site in question – Node was a no-brainer for Holler.js.
In addition to using Node.js, you built Holler.js with Faye and Alertify. Any challenges making all of them play nicely together?
Paul Bouchon: Things tend to be easy when you stand on the shoulders of giants. Faye is a powerful publish-subscribe messaging system based on the Bayeux protocol. There are other alternatives, but Faye does an exceptional job at two things: connection management and being darn simple to set up. Using its pub-sub API provided a direct channel through which I could blast any messages I wanted from server to client.
Alertify is a great project that Holler.js uses as its notification system, and it couldn’t have been easier to tie into the subscription flow used by Faye. I pipe all notification messages through a single channel to keep the footprint minimal, and Alertify’s sexy aesthetics and small API surface only made the implementation simpler. All in all, due to the solid architecture of both projects, there wasn’t any challenge in getting Faye and Alertify to play nicely together.
What are some ways users can take advantage of Holler.js?
Paul Bouchon: Holler.js can be used to issue different flavors of alerts to an app’s users in real-time. For example, if I know I’ll be bringing an app offline for a few hours, I’ll let all users currently using the app know about this upcoming downtime. And I can do so instantly with a single command from the command line. Much of the Alertify API is exposed through Holler.js, so developers have high control over the behavior of each notification sent.
Many web apps no longer require frequent page refreshes, so users may not see a newly-deployed, hardcoded notification in a timely manner. Many Holler.js users have told me that they combine Holler with such hardcoded alerts – they will send out a real-time alert, notifying all live users of some pertinent information, and then deploy an updated page with a hardcoded version of the same alert, to catch all future app visitors. Holler can also be used to refresh or redirect the current page of a web app for all live users, making it a handy admin tool. When you deploy new code, you can use Holler to easily force a refresh for all live users so they stay up-to-date with the latest version of your app.
Have you received any feedback from users?
Paul Bouchon: That’s definitely the coolest part about OSS, hearing about real people using a project you helped create. I’ve gotten nothing but helpful, constructive feedback about Holler. Users have helped me simplify its usage and distribution more than I originally thought to be possible, and they seem to really enjoy using Holler in their own projects.
Anything else cooking for you in the Node.js realm?
Paul Bouchon: Lately I’ve become a sucker for hacking the AR Drone with Node.js, using the awesome projects developed by the @nodecopter team as a foundation. I’ve been working on a small library that allows developers to map voice commands to specific Drone movements, essentially allowing for a (very, very basic) voice-controlled, Node.js-powered Drone. It’s definitely alpha at this point, but I plan to make this public soon.
Thanks, Paul! We appreciate your time and wish you all the best with Holler.js and everything else you have planned!
- What’s in the upcoming Node v0.12 release? Six new features, plus new and breaking APIs.
- Ready to develop APIs in Node.js and get them connected to your data? Check out the Node.js LoopBack framework. We’ve made it easy to get started either locally or on your favorite cloud, with a simple npm install.
- Need for Node? Learn more about both the private and open options StrongLoop offers.