Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple websocket server with EventMachine

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 config
Octocat-spinner-32 log
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 client.html
Octocat-spinner-32 client2.html
Octocat-spinner-32 jquery.min.js
Octocat-spinner-32 server.rb
README.textile

Usage

To run the server do a git clone and run it from commandline. Server supports channels. When a channel receives a message it is broadcasted to all clients connected to that channel.

 > git clone git://github.com/tuupola/em-websocket-server.git
 > cd em-websocket-server
 > ruby server.rb

Then assuming you run the server at localhost you can connect from JavaScript with something like:

 var socket = new WebSocket("ws://localhost:8080/channel");

 socket.onopen = function(event) {
    console.log(event);
 };

 socket.onmessage = function(event) {
     console.log(event);
 };

 socket.onclose = function(event) {
     console.log(event);
 };

If you want to do quick testing you can use:

 var socket = new WebSocket("ws://ws.appelsiini.net:8080/your/channel/name");
Something went wrong with that request. Please try again.