juggernaut

Realtime server push with node.js, WebSockets and Comet

Juggernaut

Juggernaut lets you push data to browser, which means you can do awesome things like multiplayer gaming, chat, realtime collaboration and more!

Juggernaut is super simple and easy to get going. Juggernaut 2, which is a completely rewrite, is built on node.js, is insanely fast, and can scale horizontally to millions of clients.

Features

  • node.js server
  • Ruby client
  • Supports the following protocols:
    • WebSocket
    • Adobe Flash Socket
    • ActiveX HTMLFile (IE)
    • Server-Sent Events (Opera)
    • XHR with multipart encoding
    • XHR with long-polling
  • Reconnection support

Subscribe (JavaScript)

Publish (Ruby)

Juggernaut.publish(“channel_name”, {:some => “data”}) Juggernaut.publish([“channel1”, “channel2”], “foo”)

Requirements

  • Node.js
  • Redis
  • Ruby

node.js requirements: * socket.io * node-static * redis-client

Installation

Running

Start Redis >> ./redis-server redis.conf

Download Juggernaut, and start the Juggernaut server: >> git clone git://github.com/maccman/juggernaut.git >> cd juggernaut >> node server.js

That’s it! Now go to http://localhost:8080/ to see Juggernaut in action.

Start the server using root if you want Flash support. It needs to open a restricted port.

Daemonize

http://kevin.vanzonneveld.net/techblog/article/run_nodejs_as_a_service_on_ubuntu_karmic/

Scaling

Just create more Juggernaut daemons. Put a TCP load balancer in front of them. Make sure they all connect to the same Redis instance. Use sticky sessions.

Usage case - Group Chat

Juggernaut.publish(“/chats”, params[:body])

Usage case - Private Chat

Juggernaut.publish(users.map {|u| “/chats/#{u.id}” }, params[:body])

Usage case - Model Synchronisation

Implement sync_clients on models

def sync_clients users.map(&:id) end

Check out client/examples/juggernaut_observer.rb and client/examples/juggernaut_observer.js

Related Repositories

juggernaut

juggernaut

[DEPRECATED] Realtime server push with node.js, WebSockets and Comet ...

cap-recipes

cap-recipes

Battle-tested capistrano recipes for ruby, rubygems, apache, passenger, delayed_job, juggernaut, thinking_sphinx, mongodb, whenever, among other popular tools ...

chat_sandbox

chat_sandbox

This is a Bare Bones app used to demonstrate what Juggernaut has to offer ...

Cappuccino-X-Juggernaut

Cappuccino-X-Juggernaut

A demo application coded with the Cappuccino framework which uses the Juggernaut push server ...

cap-recipes

cap-recipes

Battle-tested capistrano recipes for ruby, rubygems, apache, passenger, delayed_job, juggernaut, thinking_sphinx, mongodb, whenever, among other popular tools ...