Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Simple server push implementation using eventmachine and long polling
JavaScript Ruby
branch: master

YAML fix

latest commit 8b8217ac59
@winton authored
Failed to load latest commit information.
bin README, minor tweaks
lib Pulling memprof out of project
public memprof output
spec First puggernaut commit
.gitignore Everything working (unspec'd)
LICENSE First puggernaut commit README
Rakefile First puggernaut commit Basic spec running
puggernaut.gemspec Version 0.1.2


Simple server push implementation using eventmachine and long polling.



gem install puggernaut

How it works

Puggernaut consists of four pieces:

  • TCP client to send push messages
  • TCP server to receive push messages
  • TCP server to deliver messages via WebSockets (em-websocket)
  • HTTP server to deliver messages via long poll

Start it up

Run the puggernaut binary with optional port numbers:

puggernaut <http port> <tcp port> <tcp port (websocket)>

The default HTTP and TCP ports are 8100, 8101, and 8102, respectively.

Set up proxy pass

Set up a URL on your public facing web server that points to the Puggernaut HTTP server (long poll).

We all use Nginx, right?


server {
    location /long_poll {
      proxy_pass http://localhost:8100/;

Send push messages

require 'puggernaut'

client ="localhost:8101", "localhost:9101")
client.push :channel => "message"
client.push :channel => [ "message 1", "message 2" ], :channel_2 => "message"

The initializer accepts any number of TCP server addresses.

Receive push messages

Include jQuery and puggernaut.js into to your HTML page.

Javascript client example:

Puggernaut.path = '/long_poll'; // (default long poll path)
Puggernaut.port = 8102;         // (default WebSocket port)

  .watch('channel', function(e, message) {
    // do something with message
  .watch('channel_2', function(e, message) {
    // do something with message


Running specs

Specs are a work in progress, though we can vouch for some of the functionality :).

Set up Nginx to point to a cloned copy of this project:


server {
    listen 80;
    server_name localhost;
    root /Users/me/puggernaut/public;
    passenger_enabled on;
    location /long_poll {
        proxy_pass http://localhost:8100/;

You have now set up an instance of Puggernaut's spec server.

Start up an instance of Puggernaut by running bin/puggernaut.

When you visit http://localhost you will find a page that executes QUnit specs.

Something went wrong with that request. Please try again.