magicbus 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/magicbus/publisher.rb +2 -8
- data/lib/magicbus/version.rb +1 -1
- metadata +2 -2
data/lib/magicbus/publisher.rb
CHANGED
@@ -5,9 +5,7 @@ class MagicBus::Publisher
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.scatter(group, action, model, &block)
|
8
|
-
|
9
|
-
warn 'Scattering message'
|
10
|
-
|
8
|
+
|
11
9
|
MagicBus::Subscriber.connected_users(group).each do |user_id|
|
12
10
|
user = User.find(user_id)
|
13
11
|
self.send_to(user_id, action, model, block.call(user))
|
@@ -16,8 +14,6 @@ class MagicBus::Publisher
|
|
16
14
|
end
|
17
15
|
|
18
16
|
def self.broadcast(group, action, model, data = nil)
|
19
|
-
|
20
|
-
warn 'Broadcasting message'
|
21
17
|
|
22
18
|
MagicBus::Subscriber.connected_users(group).each do |user_id|
|
23
19
|
self.send_to(user_id, action, model, data)
|
@@ -26,8 +22,6 @@ class MagicBus::Publisher
|
|
26
22
|
end
|
27
23
|
|
28
24
|
def self.send_to(user_id, action, model, data)
|
29
|
-
|
30
|
-
warn 'Sending data to client'
|
31
25
|
|
32
26
|
data = { action: action, model: model, data: data }
|
33
27
|
|
@@ -44,7 +38,7 @@ class MagicBus::Publisher
|
|
44
38
|
channel = MagicBus::Subscriber.channels[user_id]
|
45
39
|
|
46
40
|
if channel
|
47
|
-
exchange = channel.
|
41
|
+
exchange = channel.exchange('syme', type: 'fanout')
|
48
42
|
exchange.publish(data.to_json, routing_key: user_id)
|
49
43
|
end
|
50
44
|
|
data/lib/magicbus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magicbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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-
|
12
|
+
date: 2013-07-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: amqp
|