sinatra-websocketio 0.2.0 → 0.2.1
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-websocketio/version.rb +1 -1
- data/lib/sinatra-websocketio/websocketio.rb +8 -5
- metadata +2 -2
data/History.txt
CHANGED
@@ -47,13 +47,16 @@ module Sinatra
|
|
47
47
|
|
48
48
|
def self.push(type, data, opt={})
|
49
49
|
session_ids = opt[:to].to_s.empty? ? self.sessions.keys : [opt[:to]]
|
50
|
-
|
51
|
-
|
52
|
-
s = sessions[id]
|
50
|
+
if opt.include? :to and self.sessions.include? opt[:to]
|
51
|
+
s = self.sessions[opt[:to]]
|
53
52
|
begin
|
54
53
|
s.send({:type => type, :data => data}.to_json)
|
55
|
-
rescue
|
56
|
-
|
54
|
+
rescue => e
|
55
|
+
emit :error, "websocketio push error (session:#{opt[:to]})"
|
56
|
+
end
|
57
|
+
else
|
58
|
+
self.sessions.keys.each do |id|
|
59
|
+
push type, data, :to => id
|
57
60
|
end
|
58
61
|
end
|
59
62
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-websocketio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
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: minitest
|