From 53c4b4160a5298ca19ce6bc9c37acc0770a5d053 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 6 Jul 2015 19:24:49 +0200 Subject: Bundle connect/disconnect callbacks together with all other subscribe callbacks --- lib/action_cable/channel/base.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/action_cable') diff --git a/lib/action_cable/channel/base.rb b/lib/action_cable/channel/base.rb index 335d2d9d7c..fc229c9f27 100644 --- a/lib/action_cable/channel/base.rb +++ b/lib/action_cable/channel/base.rb @@ -4,6 +4,9 @@ module ActionCable include Callbacks include Streams + on_subscribe :connect + on_unsubscribe :disconnect + on_subscribe :start_periodic_timers on_unsubscribe :stop_periodic_timers @@ -27,7 +30,6 @@ module ActionCable def perform_connection logger.info "#{channel_name} connecting" - connect run_subscribe_callbacks end @@ -47,7 +49,6 @@ module ActionCable end def perform_disconnection - disconnect run_unsubscribe_callbacks logger.info "#{channel_name} disconnected" end -- cgit v1.2.3