README.md in sinatra-cometio-0.3.1 vs README.md in sinatra-cometio-0.3.2

- old
+ new

@@ -32,12 +32,14 @@ set :cometio, :timeout => 120 run Sinatra::Application ``` ```ruby -cometio.push :temperature, 35 # to all clients -cometio.push :light, {:value => 150}, {:to => session_id} # to specific client +io = Sinatra::CometIO + +io.push :temperature, 35 # to all clients +io.push :light, {:value => 150}, {:to => session_id} # to specific client ``` Client Side ```html @@ -64,11 +66,11 @@ ``` Server Side ```ruby -cometio.on :chat do |data, session| +io.on :chat do |data, session| puts "#{data['name']} : #{data['message']} <#{session}>" end ## => "shokai : hello <12abcde345f6g7h8ijk>" ``` @@ -83,15 +85,15 @@ ``` Server Side ```ruby -cometio.on :connect do |session| +io.on :connect do |session| puts "new client <#{session}>" end -cometio.on :disconnect do |session| +io.on :disconnect do |session| puts "client disconnected <#{session}>" end ``` ### On "error" Event @@ -107,19 +109,19 @@ ### Remove Event Listener Server Side ```ruby -event_id = cometio.on :chat do |data, from| +event_id = io.on :chat do |data, from| puts "#{data} - from#{from}" end -cometio.removeListener event_id +io.removeListener event_id ``` or ```ruby -cometio.removeListener :chat # remove all "chat" listener +io.removeListener :chat # remove all "chat" listener ``` Client Side \ No newline at end of file