Juggernaut in Windows

By Chris, 03/09/2012, in Code & tutorials

Note: This is an old post, and no longer relevant as Juggernaut is no longer a thing. Just use socket.io directly.

I've fallen in love with Juggernaut.

Juggernaut gives you a realtime connection between your servers and client browsers. You can literally push data to clients using your web application, which lets you do awesome things like multiplayer gaming, chat, group collaboration and more.

It's built on node.js, socket.io, and Redis and makes implementing PubSub in your web apps super easy. (How easy is it?) This easy:

Client side (subscriber)

var jug = new Juggernaut;
jug.subscribe("channel1", function(data){
    alert("New message: " + data);

Server side (publisher - I'll use Python, but Ruby is similar)

jug = Juggernaut()
jug.publish('channel', {'message': 'Hello World!'})

I use Juggernaut to implement real time features in my Flask application. Flask is a traditional web framework and not very well suited to real-time. Juggernaut is a great complement. My development environment is Windows, so I needed to get Juggernaut running there. It wasn't terribly difficult but there were enough gotchas that I thought I'd share how it's done (and that it can be done).

This assumes you have Python 2.7 installed. I would not recommend deploying Juggernaut in production on Windows. Here we go:

Hope this helped some folks. Enjoy your shiny new real-time web component!

Like what you read? Join the newsletter and get updated when there's something new.