Skip to content
A demo application to accompany my talk about HTML5 Web Sockets
JavaScript Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Web Sockets Demo

What is this?

This super-simple application is a demo that accompanies my Introduction to HTML5 Web Sockets talk. This is intended to serve as a launching point for you to play around with Web sockets powered by Pusher (

How do I get started?

I'm working with the understanding that you have your favorite flavor of Ruby installed and working. Assuming that's true…

Clone this repository:

$ git clone git://
$ cd web_sockets_demo

Make sure Rubygems is up to date and you have Bundler installed:

$ gem update --system
$ gem install bundler

Install dependencies with Bundler:

$ bundle install

Start the server:

$ ruby server.rb

Check out the demo at localhost:4567

That worked, now what?

Start playing! This is obviously quite bare bones, but it should give you a starting point. Either try adding a new feature or two to your chat client, or blow away the chat client code entirely and create your own socket powered mini-app!

By default, the app is pushing and receiving messages on the shared Pusher channel 'demo_chat'. If you want to use your own 'private' channel instead, rename the channel to your own unique string. You will need to change this line in server.rb:

CHANNEL = 'demo_chat'

… and this line in public/javascripts/chat.js:

var PUSHER_CHANNEL_NAME = 'demo_chat'

For simplicity sake I decided to run this demo using Sinatra/HAML/jQuery, but you could certainly implement this in Rails/ERB/Prototype if you were so inclined.

Um, a little help?

Just in case you're not familiar with one of these libraries, here are some docs:

Something went wrong with that request. Please try again.