sinatra-websocketio 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt
CHANGED
@@ -24,9 +24,7 @@ module Sinatra
|
|
24
24
|
ws.send({:type => :error, :data => "invalid session_id (#{session_id})"}.to_json)
|
25
25
|
ws.close
|
26
26
|
else
|
27
|
-
self.sessions[session_id] =
|
28
|
-
:websocket => ws
|
29
|
-
}
|
27
|
+
self.sessions[session_id] = ws
|
30
28
|
ws.onclose do
|
31
29
|
self.sessions.delete session_id
|
32
30
|
self.emit :disconnect, session_id
|
@@ -51,9 +49,10 @@ module Sinatra
|
|
51
49
|
def self.push(type, data, opt={})
|
52
50
|
session_ids = opt[:to].to_s.empty? ? self.sessions.keys : [opt[:to]]
|
53
51
|
session_ids.each do |id|
|
52
|
+
next unless sessions.include? id
|
54
53
|
s = sessions[id]
|
55
54
|
begin
|
56
|
-
s
|
55
|
+
s.send({:type => type, :data => data}.to_json)
|
57
56
|
rescue
|
58
57
|
next
|
59
58
|
end
|
@@ -61,11 +60,7 @@ module Sinatra
|
|
61
60
|
end
|
62
61
|
|
63
62
|
def self.sessions
|
64
|
-
@@sessions ||= Hash.new
|
65
|
-
h[session_id] = {
|
66
|
-
:websocket => nil
|
67
|
-
}
|
68
|
-
}
|
63
|
+
@@sessions ||= Hash.new
|
69
64
|
end
|
70
65
|
|
71
66
|
def self.create_session(ip_addr)
|
data/sinatra-websocketio.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.version = Sinatra::WebSocketIO::VERSION
|
8
8
|
gem.authors = ["Sho Hashimoto"]
|
9
9
|
gem.email = ["hashimoto@shokai.org"]
|
10
|
-
gem.description = %q{
|
10
|
+
gem.description = %q{WebSocket component for Sinatra RocketIO}
|
11
11
|
gem.summary = gem.description
|
12
12
|
gem.homepage = "http://shokai.github.com/sinatra-websocketio"
|
13
13
|
|
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.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -139,7 +139,7 @@ dependencies:
|
|
139
139
|
- - ! '>='
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: 0.1.1
|
142
|
-
description:
|
142
|
+
description: WebSocket component for Sinatra RocketIO
|
143
143
|
email:
|
144
144
|
- hashimoto@shokai.org
|
145
145
|
executables: []
|
@@ -204,7 +204,7 @@ rubyforge_project:
|
|
204
204
|
rubygems_version: 1.8.24
|
205
205
|
signing_key:
|
206
206
|
specification_version: 3
|
207
|
-
summary:
|
207
|
+
summary: WebSocket component for Sinatra RocketIO
|
208
208
|
test_files:
|
209
209
|
- test/app.rb
|
210
210
|
- test/app/config.ru
|