sinatra-cometio 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/sinatra-cometio/cometio.rb +6 -4
- data/lib/sinatra-cometio/version.rb +1 -1
- data/sample/README.md +1 -1
- data/test/test_cometio.rb +3 -3
- metadata +4 -4
data/History.txt
CHANGED
@@ -27,10 +27,8 @@ module Sinatra
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.push(type, data, opt={})
|
30
|
-
|
31
|
-
|
32
|
-
next unless self.sessions.include? id
|
33
|
-
s = self.sessions[id]
|
30
|
+
if opt.include? :to and self.sessions.include? opt[:to]
|
31
|
+
s = self.sessions[opt[:to]]
|
34
32
|
if s[:queue].empty? and s[:stream] != nil
|
35
33
|
begin
|
36
34
|
s[:stream].write([{:type => type, :data => data}].to_json)
|
@@ -43,6 +41,10 @@ module Sinatra
|
|
43
41
|
else
|
44
42
|
s[:queue].push :type => type, :data => data
|
45
43
|
end
|
44
|
+
else
|
45
|
+
self.sessions.keys.each do |id|
|
46
|
+
push type, data, :to => id
|
47
|
+
end
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
data/sample/README.md
CHANGED
data/test/test_cometio.rb
CHANGED
@@ -22,7 +22,7 @@ class TestCometio < MiniTest::Unit::TestCase
|
|
22
22
|
push :broadcast, post_data
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
50.times do
|
26
26
|
break if res != nil
|
27
27
|
sleep 0.1
|
28
28
|
end
|
@@ -56,7 +56,7 @@ class TestCometio < MiniTest::Unit::TestCase
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
50.times do
|
60
60
|
break if res != nil
|
61
61
|
sleep 0.1
|
62
62
|
end
|
@@ -89,7 +89,7 @@ class TestCometio < MiniTest::Unit::TestCase
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
|
92
|
+
50.times do
|
93
93
|
break if res != nil
|
94
94
|
sleep 0.1
|
95
95
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-cometio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
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-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -255,7 +255,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
255
255
|
version: '0'
|
256
256
|
segments:
|
257
257
|
- 0
|
258
|
-
hash: -
|
258
|
+
hash: -2773657054308243354
|
259
259
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
260
|
none: false
|
261
261
|
requirements:
|
@@ -264,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
264
|
version: '0'
|
265
265
|
segments:
|
266
266
|
- 0
|
267
|
-
hash: -
|
267
|
+
hash: -2773657054308243354
|
268
268
|
requirements: []
|
269
269
|
rubyforge_project:
|
270
270
|
rubygems_version: 1.8.24
|