diff options
author | Javan Makhmali <javan@javan.us> | 2015-11-06 15:34:31 -0500 |
---|---|---|
committer | Javan Makhmali <javan@javan.us> | 2015-11-06 15:34:31 -0500 |
commit | 63cdbf87ddaeb6bbc852de7ca2c504b7f6a22321 (patch) | |
tree | 4f7804c0459ec6d37e151610271d56efd4ee9fea /lib/action_cable/channel | |
parent | e2ed68cc70925372681c2fb50b505b110825c8f7 (diff) | |
parent | 365891d5eff15a53919688ac78ac9af3edc0d664 (diff) | |
download | rails-63cdbf87ddaeb6bbc852de7ca2c504b7f6a22321.tar.gz rails-63cdbf87ddaeb6bbc852de7ca2c504b7f6a22321.tar.bz2 rails-63cdbf87ddaeb6bbc852de7ca2c504b7f6a22321.zip |
Merge pull request #117 from rails/shared-constants
Share internal identifiers and message types with the JavaScript client
Diffstat (limited to 'lib/action_cable/channel')
-rw-r--r-- | lib/action_cable/channel/base.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/action_cable/channel/base.rb b/lib/action_cable/channel/base.rb index b0e112ce38..ca903a810d 100644 --- a/lib/action_cable/channel/base.rb +++ b/lib/action_cable/channel/base.rb @@ -89,9 +89,6 @@ module ActionCable include Naming include Broadcasting - SUBSCRIPTION_CONFIRMATION_INTERNAL_MESSAGE = 'confirm_subscription'.freeze - SUBSCRIPTION_REJECTION_INTERNAL_MESSAGE = 'reject_subscription'.freeze - attr_reader :params, :connection, :identifier delegate :logger, to: :connection @@ -258,7 +255,7 @@ module ActionCable def transmit_subscription_confirmation 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) + connection.transmit ActiveSupport::JSON.encode(identifier: @identifier, type: ActionCable::INTERNAL[:message_types][:confirmation]) @subscription_confirmation_sent = true end end @@ -270,7 +267,7 @@ module ActionCable def transmit_subscription_rejection logger.info "#{self.class.name} is transmitting the subscription rejection" - connection.transmit ActiveSupport::JSON.encode(identifier: @identifier, type: SUBSCRIPTION_REJECTION_INTERNAL_MESSAGE) + connection.transmit ActiveSupport::JSON.encode(identifier: @identifier, type: ActionCable::INTERNAL[:message_types][:rejection]) end end end |