celluloid_pubsub 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/celluloid_pubsub/redis_reactor.rb +15 -5
- data/lib/celluloid_pubsub/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: 762f09a19b7978a014083ac04ed2117444bb758f
|
4
|
+
data.tar.gz: 344636d89975e472df57cef5143ed30a211375be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb978cb0ed74b9835aaeb43105aba2130602a5e841dc968d8f9127cc88a4136b2f8663f6f85feaeac1eec9bf487febd307a8934e816b6fa71397abe5cc5e871
|
7
|
+
data.tar.gz: 74b9060bb3d673b41565a9167c745578403aefa59f6a644e89730da72bb337dd928788157f54902c11cc3b955678b62a73698c28ffcffc091137bd9cd778cf41
|
@@ -185,7 +185,8 @@ module CelluloidPubsub
|
|
185
185
|
fetch_pubsub do |pubsub|
|
186
186
|
callback = prepare_redis_action(pubsub, action)
|
187
187
|
success_message = action_success(action, channel, message)
|
188
|
-
|
188
|
+
args = action_subscribe?(action) ? [channel, callback] : [channel]
|
189
|
+
subscription = pubsub.send(action, *args)
|
189
190
|
register_subscription_callbacks(subscription, action, success_message)
|
190
191
|
end
|
191
192
|
end
|
@@ -233,10 +234,19 @@ module CelluloidPubsub
|
|
233
234
|
#
|
234
235
|
# @api private
|
235
236
|
def register_subscription_callbacks(subscription, action, sucess_message = nil)
|
236
|
-
register_redis_callback(subscription, sucess_message)
|
237
|
+
register_redis_callback(subscription,action, sucess_message)
|
237
238
|
register_redis_error_callback(subscription, action)
|
238
239
|
end
|
239
|
-
|
240
|
+
# the method will return true if debug is enabled
|
241
|
+
#
|
242
|
+
#
|
243
|
+
# @return [Boolean] returns true if debug is enabled otherwise false
|
244
|
+
#
|
245
|
+
# @api public
|
246
|
+
def debug_enabled?
|
247
|
+
@server.debug_enabled?
|
248
|
+
end
|
249
|
+
|
240
250
|
# method used to register a success callback and if action is subscribe will write
|
241
251
|
# back to the websocket a message that will say it is a successful_subscription
|
242
252
|
# If action is something else, will log the incoming message
|
@@ -248,12 +258,12 @@ module CelluloidPubsub
|
|
248
258
|
# @return [void]
|
249
259
|
#
|
250
260
|
# @api private
|
251
|
-
def register_redis_callback(subscription, sucess_message = nil)
|
261
|
+
def register_redis_callback(subscription, action, sucess_message = nil)
|
252
262
|
subscription.callback do |subscriptions_ids|
|
253
263
|
if sucess_message.present?
|
254
264
|
@websocket << sucess_message.merge('subscriptions' => subscriptions_ids).to_json
|
255
265
|
else
|
256
|
-
log_debug "#{action} success #{
|
266
|
+
log_debug "#{action} success #{sucess_message.inspect}"
|
257
267
|
end
|
258
268
|
end
|
259
269
|
end
|