diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2015-11-04 09:21:06 -0700 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2015-11-04 09:21:06 -0700 |
commit | df20d87c7b50cb7b19cc176a8f7944ee9f258446 (patch) | |
tree | 8bf14769b786eec74275cb5671204c4cd844f310 /lib/action_cable | |
parent | eeb2b5cf47978005ea0827783064707af5d5c44a (diff) | |
parent | 351a663e57f2f20b3cd43b9ed751430665463659 (diff) | |
download | rails-df20d87c7b50cb7b19cc176a8f7944ee9f258446.tar.gz rails-df20d87c7b50cb7b19cc176a8f7944ee9f258446.tar.bz2 rails-df20d87c7b50cb7b19cc176a8f7944ee9f258446.zip |
Merge pull request #113 from dballona/fix-subscription-callbacks
Fixing subscription callbacks
Diffstat (limited to 'lib/action_cable')
-rw-r--r-- | lib/action_cable/channel/base.rb | 9 |
1 files changed, 6 insertions, 3 deletions
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 |