From d2a35981377bbfe3bb298c699fabae5c0b3411b8 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 7 Jul 2015 16:39:26 +0200 Subject: Switch domain language from channel connect/disconnect to subscribe/unsubscribe --- lib/action_cable/channel/base.rb | 18 +++++++++--------- lib/action_cable/connection/subscriptions.rb | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/action_cable/channel/base.rb b/lib/action_cable/channel/base.rb index 92730de09c..336bb43092 100644 --- a/lib/action_cable/channel/base.rb +++ b/lib/action_cable/channel/base.rb @@ -5,8 +5,8 @@ module ActionCable include PeriodicTimers include Streams - on_subscribe :connect - on_unsubscribe :disconnect + on_subscribe :subscribed + on_unsubscribe :unsubscribed attr_reader :params, :connection delegate :logger, to: :connection @@ -16,11 +16,11 @@ module ActionCable @channel_identifier = channel_identifier @params = params - perform_connection + subscribe_to_channel end - def perform_connection - logger.info "#{channel_name} connecting" + def subscribe_to_channel + logger.info "#{channel_name} subscribing" run_subscribe_callbacks end @@ -39,9 +39,9 @@ module ActionCable end end - def perform_disconnection + def unsubscribe_from_channel run_unsubscribe_callbacks - logger.info "#{channel_name} disconnected" + logger.info "#{channel_name} unsubscribed" end @@ -56,11 +56,11 @@ module ActionCable end - def connect + def subscribed # Override in subclasses end - def disconnect + def unsubscribed # Override in subclasses end diff --git a/lib/action_cable/connection/subscriptions.rb b/lib/action_cable/connection/subscriptions.rb index 800474eee5..7fd4f510bf 100644 --- a/lib/action_cable/connection/subscriptions.rb +++ b/lib/action_cable/connection/subscriptions.rb @@ -35,7 +35,7 @@ module ActionCable def remove(data) logger.info "Unsubscribing from channel: #{data['identifier']}" - subscriptions[data['identifier']].perform_disconnection + subscriptions[data['identifier']].unsubscribe_from_channel subscriptions.delete(data['identifier']) end @@ -49,7 +49,7 @@ module ActionCable end def cleanup - subscriptions.each { |id, channel| channel.perform_disconnection } + subscriptions.each { |id, channel| channel.unsubscribe_from_channel } end -- cgit v1.2.3