Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

A demo application to accompany my talk about HTML5 Web Sockets

Notifications You must be signed in to change notification settings

chrisjpowers/web_sockets_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (pusherapp.com).

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://github.com/chrisjpowers/web_sockets_demo.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:

About

A demo application to accompany my talk about HTML5 Web Sockets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published