sinatra-rocketio 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/README.md +7 -2
- data/lib/js/event_emitter.js +9 -6
- data/lib/sinatra-rocketio/version.rb +1 -1
- data/sample/Gemfile +2 -2
- data/sample/Gemfile.lock +8 -8
- data/sinatra-rocketio.gemspec +3 -3
- metadata +8 -8
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -52,6 +52,7 @@ Client Side
|
|
52
52
|
```
|
53
53
|
```javascript
|
54
54
|
var io = new RocketIO().connect();
|
55
|
+
|
55
56
|
io.on("temperature", function(value){
|
56
57
|
console.log("server temperature : " + value);
|
57
58
|
}); // => "server temperature : 35"
|
@@ -66,7 +67,9 @@ io.on("light", function(data){
|
|
66
67
|
Client Side
|
67
68
|
|
68
69
|
```javascript
|
69
|
-
io.
|
70
|
+
io.on("connect", function(session){
|
71
|
+
io.push("chat", {name: "shokai", message: "hello"}); // client -> server
|
72
|
+
});
|
70
73
|
```
|
71
74
|
|
72
75
|
Server Side
|
@@ -93,6 +96,7 @@ Server Side
|
|
93
96
|
```ruby
|
94
97
|
io.on :connect do |session, type|
|
95
98
|
puts "new client <#{session}> type:#{type}"
|
99
|
+
io.push :hello, "hello new client!!"
|
96
100
|
end
|
97
101
|
|
98
102
|
io.on :disconnect do |session, type|
|
@@ -148,8 +152,9 @@ Sample App
|
|
148
152
|
----------
|
149
153
|
chat app
|
150
154
|
|
151
|
-
- https://github.com/shokai/rocketio-chat-sample
|
152
155
|
- https://github.com/shokai/sinatra-rocketio/tree/master/sample
|
156
|
+
- https://github.com/shokai/rocketio-chat-sample
|
157
|
+
- https://github.com/shokai/rocketio-arduino-sample
|
153
158
|
|
154
159
|
|
155
160
|
Contributing
|
data/lib/js/event_emitter.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
// event_emitter.js v0.0.
|
1
|
+
// event_emitter.js v0.0.8
|
2
2
|
// https://github.com/shokai/event_emitter.js
|
3
3
|
// (c) 2013 Sho Hashimoto <hashimoto@shokai.org>
|
4
4
|
// The MIT License
|
@@ -38,13 +38,15 @@ var EventEmitter = function(){
|
|
38
38
|
switch(e.type){
|
39
39
|
case type:
|
40
40
|
e.listener(data);
|
41
|
+
if(e.once) e.type = null;
|
41
42
|
break
|
42
|
-
case
|
43
|
+
case "*":
|
43
44
|
e.listener(type, data);
|
45
|
+
if(e.once) e.type = null;
|
44
46
|
break
|
45
47
|
}
|
46
|
-
if(e.once) self.removeListener(e.id);
|
47
48
|
}
|
49
|
+
self.removeListener();
|
48
50
|
};
|
49
51
|
|
50
52
|
this.removeListener = function(id_or_type){
|
@@ -52,10 +54,11 @@ var EventEmitter = function(){
|
|
52
54
|
var e = self.__events[i];
|
53
55
|
switch(typeof id_or_type){
|
54
56
|
case "number":
|
55
|
-
if(e.id
|
57
|
+
if(e.id === id_or_type) self.__events.splice(i,1);
|
56
58
|
break
|
57
59
|
case "string":
|
58
|
-
|
60
|
+
case "object":
|
61
|
+
if(e.type === id_or_type) self.__events.splice(i,1);
|
59
62
|
break
|
60
63
|
}
|
61
64
|
}
|
@@ -63,6 +66,6 @@ var EventEmitter = function(){
|
|
63
66
|
|
64
67
|
};
|
65
68
|
|
66
|
-
if(typeof module !==
|
69
|
+
if(typeof module !== "undefined" && typeof module.exports !== "undefined"){
|
67
70
|
module.exports = EventEmitter;
|
68
71
|
}
|
data/sample/Gemfile
CHANGED
data/sample/Gemfile.lock
CHANGED
@@ -10,11 +10,11 @@ GEM
|
|
10
10
|
em-websocket-client (0.1.1)
|
11
11
|
eventmachine
|
12
12
|
libwebsocket
|
13
|
-
event_emitter (0.2.
|
13
|
+
event_emitter (0.2.4)
|
14
14
|
eventmachine (1.0.3)
|
15
15
|
foreman (0.62.0)
|
16
16
|
thor (>= 0.13.6)
|
17
|
-
haml (4.0.
|
17
|
+
haml (4.0.1)
|
18
18
|
tilt
|
19
19
|
http_parser.rb (0.5.3)
|
20
20
|
httparty (0.10.2)
|
@@ -36,8 +36,8 @@ GEM
|
|
36
36
|
rack (~> 1.4)
|
37
37
|
rack-protection (~> 1.3)
|
38
38
|
tilt (~> 1.3, >= 1.3.3)
|
39
|
-
sinatra-cometio (0.3.
|
40
|
-
event_emitter (
|
39
|
+
sinatra-cometio (0.3.9)
|
40
|
+
event_emitter (>= 0.2.4)
|
41
41
|
eventmachine (>= 1.0.0)
|
42
42
|
httparty (>= 0.10.2)
|
43
43
|
json (>= 1.7.0)
|
@@ -50,10 +50,10 @@ GEM
|
|
50
50
|
rack-test
|
51
51
|
sinatra (~> 1.3.0)
|
52
52
|
tilt (~> 1.3)
|
53
|
-
sinatra-websocketio (0.1.
|
53
|
+
sinatra-websocketio (0.1.7)
|
54
54
|
em-websocket (>= 0.5.0)
|
55
55
|
em-websocket-client (>= 0.1.1)
|
56
|
-
event_emitter (
|
56
|
+
event_emitter (>= 0.2.4)
|
57
57
|
eventmachine (>= 1.0.0)
|
58
58
|
json (>= 1.7.0)
|
59
59
|
sinatra (>= 1.3.0)
|
@@ -76,6 +76,6 @@ DEPENDENCIES
|
|
76
76
|
rack
|
77
77
|
sass
|
78
78
|
sinatra
|
79
|
-
sinatra-cometio (>= 0.3.
|
80
|
-
sinatra-websocketio (>= 0.1.
|
79
|
+
sinatra-cometio (>= 0.3.9)
|
80
|
+
sinatra-websocketio (>= 0.1.7)
|
81
81
|
thin
|
data/sinatra-rocketio.gemspec
CHANGED
@@ -15,9 +15,9 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
17
|
gem.require_paths = ["lib"]
|
18
|
-
gem.add_dependency "sinatra-cometio", ">= 0.3.
|
19
|
-
gem.add_dependency "sinatra-websocketio", ">= 0.1.
|
18
|
+
gem.add_dependency "sinatra-cometio", ">= 0.3.9"
|
19
|
+
gem.add_dependency "sinatra-websocketio", ">= 0.1.7"
|
20
20
|
gem.add_dependency "sinatra"
|
21
21
|
gem.add_dependency "eventmachine", ">= 1.0.0"
|
22
|
-
gem.add_dependency "event_emitter", ">= 0.2.
|
22
|
+
gem.add_dependency "event_emitter", ">= 0.2.4"
|
23
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-rocketio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra-cometio
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.3.
|
21
|
+
version: 0.3.9
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.3.
|
29
|
+
version: 0.3.9
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: sinatra-websocketio
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.1.
|
37
|
+
version: 0.1.7
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.1.
|
45
|
+
version: 0.1.7
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: sinatra
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.2.
|
85
|
+
version: 0.2.4
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.2.
|
93
|
+
version: 0.2.4
|
94
94
|
description: WebSocket/Comet IO plugin for Sinatra
|
95
95
|
email:
|
96
96
|
- hashimoto@shokai.org
|