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 CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.2.1 2013-03-26
2
+
3
+ * fix WebSocketIO::push
4
+
1
5
  === 0.2.0 2013-03-23
2
6
 
3
7
  * add Sinatra::WebSocketIO::Client
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module WebSocketIO
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -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
- session_ids.each do |id|
51
- next unless sessions.include? id
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
- next
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.0
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-23 00:00:00.000000000 Z
12
+ date: 2013-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest