README.md in sinatra-cometio-0.3.9 vs README.md in sinatra-cometio-0.4.0

- old
+ new

@@ -42,15 +42,16 @@ ``` Client Side ```html -<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> +<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="<%= cometio_js %>"></script> ``` ```javascript var io = new CometIO().connect(); + io.on("temperature", function(value){ console.log("server temperature : " + value); }); // => "server temperature : 35" io.on("light", function(data){ console.log("server light sensor : " + data.value); @@ -61,11 +62,13 @@ ### Client --(Ajax)--> Server Client Side ```javascript -io.push("chat", {name: "shokai", message: "hello"}); // client -> server +io.on("connect", function(){ + io.push("chat", {name: "shokai", message: "hello"}); // client -> server +}); ``` Server Side ```ruby @@ -78,19 +81,20 @@ ### On "connect" Event Client Side ```javascript -io.on("connect", function(session){ - alert("connect!!"); +io.on("connect", function(session_id){ + alert("connect!! "+session_id); }); ``` Server Side ```ruby io.on :connect do |session| puts "new client <#{session}>" + io.push :hello, "hello new client!!" end io.on :disconnect do |session| puts "client disconnected <#{session}>" end \ No newline at end of file