diff options
author | Diego Ballona <root@dballona.com> | 2015-10-31 18:50:54 -0200 |
---|---|---|
committer | Diego Ballona <root@dballona.com> | 2015-11-04 13:42:56 -0200 |
commit | 351a663e57f2f20b3cd43b9ed751430665463659 (patch) | |
tree | 8bf14769b786eec74275cb5671204c4cd844f310 | |
parent | bb322ee19d203ff70cee79a058f3cae406ae338c (diff) | |
download | rails-351a663e57f2f20b3cd43b9ed751430665463659.tar.gz rails-351a663e57f2f20b3cd43b9ed751430665463659.tar.bz2 rails-351a663e57f2f20b3cd43b9ed751430665463659.zip |
Fixing subscription callbacks
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | lib/action_cable/channel/base.rb | 9 |
2 files changed, 9 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml index 350da659b9..ff7376b9e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,9 @@ matrix: allow_failures: - ruby-head +services: + - redis-server + notifications: email: false irc: diff --git a/lib/action_cable/channel/base.rb b/lib/action_cable/channel/base.rb index 7607b5ad59..2d528dfdbf 100644 --- a/lib/action_cable/channel/base.rb +++ b/lib/action_cable/channel/base.rb @@ -143,7 +143,9 @@ module ActionCable # Called by the cable connection when its cut so the channel has a chance to cleanup with callbacks. # This method is not intended to be called directly by the user. Instead, overwrite the #unsubscribed callback. def unsubscribe_from_channel - _run_unsubscribe_callbacks { unsubscribed } + run_callbacks :unsubscribe do + unsubscribed + end end @@ -192,7 +194,9 @@ module ActionCable def subscribe_to_channel - _run_subscribe_callbacks { subscribed } + run_callbacks :subscribe do + subscribed + end transmit_subscription_confirmation unless defer_subscription_confirmation? end @@ -227,7 +231,6 @@ module ActionCable unless subscription_confirmation_sent? logger.info "#{self.class.name} is transmitting the subscription confirmation" connection.transmit ActiveSupport::JSON.encode(identifier: @identifier, type: SUBSCRIPTION_CONFIRMATION_INTERNAL_MESSAGE) - @subscription_confirmation_sent = true end end |