sinatra-rocketio-linda 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/lib/sinatra-rocketio-linda/linda.rb +12 -4
- data/lib/sinatra/rocketio/linda/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00ad1eabde4c411c5f3cc5e2face0f8a7447f0d1
|
4
|
+
data.tar.gz: c3fd2667f18996af19914b5ac4c80f94d5c9fe9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89508b6b7807fd90c6c98db253af38e7875bcb97b278dc3ab8c1b1b6762741515762d4b4348f03b4139a40ddb92b4454ff47c15e3a25523d6f50fe44aa6aaf42
|
7
|
+
data.tar.gz: 7c4807cc17a4c3bbcc6cbcd9fac5e1e5b28b163aaa0e8a97f048d3fd9bea58b51bed79ce49793f1d1ce28343ffed68c63c427546bdcbdc4106588b181056342f
|
data/History.txt
CHANGED
@@ -16,6 +16,10 @@ module Sinatra
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
def self.callbacks
|
20
|
+
@@callbacks ||= Hash.new{|h,k| h[k] = Array.new }
|
21
|
+
end
|
22
|
+
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
@@ -60,12 +64,16 @@ end
|
|
60
64
|
Sinatra::RocketIO::Linda.emit :error, "received Callback ID is not valid at :__linda_#{func}"
|
61
65
|
next
|
62
66
|
end
|
63
|
-
|
67
|
+
callback_id = Sinatra::RocketIO::Linda[space].__send__ func, tuple do |tuple|
|
64
68
|
Sinatra::RocketIO.push "__linda_#{func}_callback_#{callback}", tuple, :to => client.session
|
65
69
|
Sinatra::RocketIO::Linda.emit func, Hashie::Mash.new(:space => space, :tuple => tuple), client
|
66
70
|
end
|
67
|
-
Sinatra::RocketIO.
|
68
|
-
|
69
|
-
|
71
|
+
Sinatra::RocketIO::Linda.callbacks[client.session].push(:space => space, :callback => callback_id)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
Sinatra::RocketIO.on :disconnect do |client|
|
76
|
+
Sinatra::RocketIO::Linda.callbacks[client.session].each do |i|
|
77
|
+
Sinatra::RocketIO::Linda[i[:space]].cancel i[:callback]
|
70
78
|
end
|
71
79
|
end
|