roda-component 0.1.27 → 0.1.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/roda/component/faye.rb +21 -3
- data/lib/roda/component/version.rb +1 -1
- data/lib/roda/component.rb +3 -1
- data/lib/roda/plugins/component.rb +1 -0
- data/roda-component.gemspec +1 -0
- data/test/dummy/dummy.db +0 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f394e3df58f2cc1e6ae4b050f1d3fa1c115e619a
|
4
|
+
data.tar.gz: 493c91445c9a9a4e609671c2e69b090cdb0a1671
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f69f31e023c2c386f62ac663e05965893df6be7da0b32c793da25d5b55fdecb98a64bba9be28f57acb95266cae653a95523c9b321ad8995e6f2e830a85fa342
|
7
|
+
data.tar.gz: 2da6028f1ab9951904757aebe7f7baa5452002a3585bd181e3c57c0fa9558c94837f7446612ff87bf03f71ee18cbd5a065c0b2cae85052a295cc7c6940578cb9
|
data/lib/roda/component/faye.rb
CHANGED
@@ -128,11 +128,12 @@ else
|
|
128
128
|
|
129
129
|
case message['channel']
|
130
130
|
when '/meta/connect'
|
131
|
+
callback.call message
|
132
|
+
|
131
133
|
if session_id
|
132
134
|
redis.call 'HSET', "#{key}/ids", private_id, public_id
|
133
135
|
# puts redis.call 'HGETALL', "#{key}/ids"
|
134
136
|
end
|
135
|
-
callback.call message
|
136
137
|
when '/meta/disconnect'
|
137
138
|
callback.call message
|
138
139
|
|
@@ -203,8 +204,25 @@ else
|
|
203
204
|
data = app.roda_component(:"#{component_name}", { trigger: (joining ? :join : :leave), public_id: public_id, private_id: private_id })
|
204
205
|
|
205
206
|
url = "http#{request.env['SERVER_PORT'] == '443' ? 's' : ''}://#{request.env['SERVER_NAME']}:#{request.env['SERVER_PORT']}/faye"
|
206
|
-
client = ::Faye::Client.new(url)
|
207
|
-
client.publish "/components/#{component_name}", type: (joining ? 'join' : 'leave'), public_id: public_id, token: app.component_opts[:token], local: data
|
207
|
+
# client = ::Faye::Client.new(url)
|
208
|
+
# client.publish "/components/#{component_name}", type: (joining ? 'join' : 'leave'), public_id: public_id, token: app.component_opts[:token], local: data
|
209
|
+
# EM.run {
|
210
|
+
http = EM::HttpRequest.new(url).post(
|
211
|
+
head: {
|
212
|
+
'content-type' => 'application/json'
|
213
|
+
},
|
214
|
+
body: {
|
215
|
+
channel: "/components/#{component_name}",
|
216
|
+
data: {
|
217
|
+
type: (joining ? 'join' : 'leave'), public_id: public_id, token: app.component_opts[:token], local: data }
|
218
|
+
}.to_json
|
219
|
+
)
|
220
|
+
# http.callback {
|
221
|
+
# ap http.response_header.status
|
222
|
+
# ap http.response_header
|
223
|
+
# ap http.response
|
224
|
+
# }
|
225
|
+
# }
|
208
226
|
end
|
209
227
|
|
210
228
|
# /components/:id/:comp/:action
|
data/lib/roda/component.rb
CHANGED
@@ -110,7 +110,9 @@ class Roda
|
|
110
110
|
def initialize(scope = false)
|
111
111
|
@scope = scope
|
112
112
|
|
113
|
-
if client?
|
113
|
+
if client? && !$component_opts[:faye][:"#{self.class._name}"]
|
114
|
+
$component_opts[:faye][:"#{self.class._name}"] = true
|
115
|
+
|
114
116
|
$faye.subscribe "/components/#{self.class._name}" do |msg|
|
115
117
|
msg = Native(msg)
|
116
118
|
|
data/roda-component.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_runtime_dependency "opal", "~> 0.7.0.beta3"
|
22
22
|
spec.add_runtime_dependency "opal-jquery", "~> 0.3.0.beta2"
|
23
23
|
spec.add_runtime_dependency "redis-rack"
|
24
|
+
spec.add_runtime_dependency "rest-client"
|
24
25
|
spec.add_runtime_dependency "faye", '~> 1.1.0'
|
25
26
|
spec.add_runtime_dependency "faye-redis"
|
26
27
|
spec.add_runtime_dependency "redic", "~> 1.1.1"
|
data/test/dummy/dummy.db
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roda-component
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cj
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: faye
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|