Boldr by N. Merouze

Real World Node.js - Redis and streaming

Non-blocking async I/O frameworks are the new hotness, I’ve already said it. But aside the buzzwords, what can we do with these frameworks? Here’s a few examples using Node.js.

Track users with Redis

Rick Olson has developed a library to track what users are on which pages using Redis to store the data.

Track users with Redis and Node.js

Now you can track users in real-time! It’s a neat feature to know who is editing a wiki page at the same time as you but real-time generates a lot of requests. If your server blocks the process for each request your server is gonna be stuck quickly.

Thanks to Node.js and the async Redis client your server will be in better shape.

Streaming

Remember my article about Twitter Stream with Websockets? There’s the same here but with Node.js. As you can see the RabbitMQ part is not present because it is not really necessary with a non-blocking framework. But having a queue is recommended at some point (generally when you use more than one process).

Streaming with a classic web framework is hard to code (= to avoid blocking the process). With Node.js you almost don’t realize that you stream data!

Here’s some useful code about streaming with Node.js:

There’s more

Don’t forget to check out the Node.js wiki to have a longer list of applications.