aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/channel
diff options
context:
space:
mode:
authorJavan Makhmali <javan@javan.us>2015-11-06 14:09:38 -0500
committerJavan Makhmali <javan@javan.us>2015-11-06 14:09:38 -0500
commit365891d5eff15a53919688ac78ac9af3edc0d664 (patch)
tree4f7804c0459ec6d37e151610271d56efd4ee9fea /lib/action_cable/channel
parente2ed68cc70925372681c2fb50b505b110825c8f7 (diff)
downloadrails-365891d5eff15a53919688ac78ac9af3edc0d664.tar.gz
rails-365891d5eff15a53919688ac78ac9af3edc0d664.tar.bz2
rails-365891d5eff15a53919688ac78ac9af3edc0d664.zip
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.rb7
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