-
Notifications
You must be signed in to change notification settings - Fork 3
rocketio.js
Sho Hashimoto edited this page Jun 5, 2013
·
1 revision
RocketIO Ruby client for JavaScript
<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);
});
var io = new RocketIO({type: "comet"}).connect("http://example.com");
var io = new RocketIO({type: "websocket"}).connect("http://example.com");
var io = new RocketIO({channel: "ch1"}).connect("http://example.com");
var io = new RocketIO({type: "comet", channel: "ch2"}).connect("http://example.com");