diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-07-07 16:39:26 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-07-07 19:03:57 +0200 |
commit | d2a35981377bbfe3bb298c699fabae5c0b3411b8 (patch) | |
tree | e1db71ea5a7a465569997cdb2140ef81e05af72c | |
parent | ab77cb721d2679eb1045f04e5efe720decd67135 (diff) | |
download | rails-d2a35981377bbfe3bb298c699fabae5c0b3411b8.tar.gz rails-d2a35981377bbfe3bb298c699fabae5c0b3411b8.tar.bz2 rails-d2a35981377bbfe3bb298c699fabae5c0b3411b8.zip |
Switch domain language from channel connect/disconnect to subscribe/unsubscribe
-rw-r--r-- | lib/action_cable/channel/base.rb | 18 | ||||
-rw-r--r-- | lib/action_cable/connection/subscriptions.rb | 4 |
2 files changed, 11 insertions, 11 deletions
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 |