From 365891d5eff15a53919688ac78ac9af3edc0d664 Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Fri, 6 Nov 2015 14:09:38 -0500 Subject: Share internal identifiers and message types with the JavaScript client --- lib/action_cable/channel/base.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/action_cable/channel') 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 -- cgit v1.2.3