Skip to content
Sho Hashimoto edited this page Jun 5, 2013 · 1 revision

RocketIO Ruby client for JavaScript

Download

Usage

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="/rocketio.min.js"></script>
var io = new RocketIO().connect("http://example.com");

io.on("connect", function(){
  alert(io.type + " connect!! " + io.session);
  io.push("chat", {name: "shokai", message: "hello!!"});
});

io.on("chat", function(data){
  console.log(data.name + " : " + data.message);
});

io.on("error", function(err){
  console.error(err);
});

Connection Type

var io = new RocketIO({type: "comet"}).connect("http://example.com");
var io = new RocketIO({type: "websocket"}).connect("http://example.com");

Channel

var io = new RocketIO({channel: "ch1"}).connect("http://example.com");
var io = new RocketIO({type: "comet", channel: "ch2"}).connect("http://example.com");
Clone this wiki locally