magicbus 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,19 +24,17 @@ class MagicBus::Subscriber
24
24
  channel = channels[user_id]
25
25
  exchange = channel.fanout('syme')
26
26
 
27
- self.clients[user_id] ||= {}
28
-
29
27
  client_id = SecureRandom.uuid
30
28
 
31
- self.clients[user_id][client_id] = out
32
-
33
29
  queue = channel.queue(client_id)
34
30
  .bind(exchange).subscribe do |payload|
35
31
 
36
- self.clients[user_id][client_id] <<
37
- "data: #{payload}\n\n"
32
+ out << "data: #{payload}\n\n"
38
33
 
39
34
  end
35
+
36
+ self.clients[user_id] ||= {}
37
+ self.clients[user_id][client_id] = queue
40
38
 
41
39
  client_id
42
40
 
@@ -50,11 +48,6 @@ class MagicBus::Subscriber
50
48
  self.clients[user_id][client_id] = nil
51
49
  end
52
50
 
53
- if self.clients[user_id].length == 0
54
- self.channels[user_id].close
55
- self.clients.unsubscribe(user_id)
56
- end
57
-
58
51
  end
59
52
 
60
53
  end
@@ -1,5 +1,5 @@
1
1
  module MagicBus
2
2
 
3
- VERSION = '0.0.9'
3
+ VERSION = '0.1.0'
4
4
 
5
5
  end
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.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: