diff options
Diffstat (limited to 'lib/action_cable')
-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 |