README.md in sinatra-cometio-0.2.0 vs README.md in sinatra-cometio-0.3.0
- old
+ new
@@ -32,12 +32,12 @@
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
+cometio.push :temperature, 35 # to all clients
+cometio.push :light, {:value => 150}, {:to => session_id} # to specific client
```
Client Side
```html
@@ -64,11 +64,11 @@
```
Server Side
```ruby
-CometIO.on :chat do |data, session|
+cometio.on :chat do |data, session|
puts "#{data['name']} : #{data['message']} <#{session}>"
end
## => "shokai : hello <12abcde345f6g7h8ijk>"
```
@@ -83,15 +83,15 @@
```
Server Side
```ruby
-CometIO.on :connect do |session|
+cometio.on :connect do |session|
puts "new client <#{session}>"
end
-CometIO.on :disconnect do |session|
+cometio.on :disconnect do |session|
puts "client disconnected <#{session}>"
end
```
### On "error" Event
@@ -107,19 +107,19 @@
### Remove Event Listener
Server Side
```ruby
-event_id = CometIO.on :chat do |data, from|
+event_id = cometio.on :chat do |data, from|
puts "#{data} - from#{from}"
end
-CometIO.removeListener event_id
+cometio.removeListener event_id
```
or
```ruby
-CometIO.removeListener :chat # remove all "chat" listener
+cometio.removeListener :chat # remove all "chat" listener
```
Client Side
\ No newline at end of file