wampus 0.0.4 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24dd3f5e9601271d25b1ba20bb489dcdc9d9282c
4
- data.tar.gz: 8af28ecdb9b6db135c99082f74b40e918be2e5c7
3
+ metadata.gz: bfb58f22049d9f09a70845982e65ed973ab1d05a
4
+ data.tar.gz: 9c5e02435c5282da1145a002b67c1792a74f3211
5
5
  SHA512:
6
- metadata.gz: e475438bf58140e41989c659525af5af26a3b0305aafec3cd5af6cc10068eb179a374a847c0768dc3b5b59d9832511c18fd1822187768dfe3f4a7092de52cdfe
7
- data.tar.gz: 033812f181b04eb2dfd3295fd68f98917965be1b5718bceb4ad058fdaefc6d16316747f2bbf174f5dacf391b156f9fcf3bb324e09963a6bbe2c8e2454893345e
6
+ metadata.gz: fab955b9b85aa6fb3a99fe7c325ddd1637e7b7bd73c8b3913b4827d289be06829c677d3a1b0066d0b2955fb0cf5d9219d5f25d86a9211bdf6be7c44d5e4607e0
7
+ data.tar.gz: e6ca9efc648328ec02d8d43cef3309869eff6c78934ba7ea85eda40d195412602bef68bb9fbabdd43cc0230cd434ba0b5cff51c63acc96c45d138c3b22ffc2bc
@@ -51,23 +51,19 @@ module Wampus
51
51
  Thread.new do
52
52
  @subscriber.subscribe(@events_namespace) do |on|
53
53
  on.message do |channel, message|
54
- handle_message(message)
54
+ handle_message_from_redis(message)
55
55
  end
56
56
  end
57
57
  end
58
58
 
59
59
  end
60
60
 
61
- def create_event(connection, topic, payload, excluded, included)
62
- create_event_on_redis(connection.id, topic.uri, payload, excluded, included)
61
+ def dispatch_event(topic_uri, payload, excluded, included)
62
+ @redis.publish @events_namespace, [SecureRandom.uuid, topic_uri, payload, excluded, included].to_json
63
63
  end
64
64
 
65
65
  private
66
66
 
67
- def create_event_on_redis(connection_id, topic_uri, payload, excluded, included)
68
- @redis.publish @events_namespace, [SecureRandom.uuid, connection_id, topic_uri, payload, excluded, included].to_json
69
- end
70
-
71
67
  def subscribe_to_events
72
68
  Thread.new do
73
69
  @subscriber.subscribe(@events_ns) do |on|
@@ -80,17 +76,14 @@ module Wampus
80
76
 
81
77
  def handle_message_from_redis(message)
82
78
  begin
83
- id, connection_id, uri, payload, excluded, included = JSON.parse(message)
79
+ msg_id, uri, payload, excluded, included = JSON.parse(message)
84
80
 
85
- connection = find_connections(:id => connection_id).first
86
81
  topic = topic_for_uri uri
87
82
 
88
83
  return unless topic
89
84
 
90
- topic.subscribers(connection, excluded, included) do |subscribers|
91
- subscribers.each do |connection|
92
- connection.write event_msg(topic.uri, payload)
93
- end
85
+ topic.subscribers(excluded, included).each do |subscriber|
86
+ subscriber.write event_msg(topic.uri, payload)
94
87
  end
95
88
  rescue => error
96
89
  # TODO Handle Error
@@ -1,3 +1,3 @@
1
1
  module Wampus
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wampus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Stack