diff options
Diffstat (limited to 'lib/action_cable/channel/base.rb')
-rw-r--r-- | lib/action_cable/channel/base.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/action_cable/channel/base.rb b/lib/action_cable/channel/base.rb index 40af1462b4..ae8822d2a2 100644 --- a/lib/action_cable/channel/base.rb +++ b/lib/action_cable/channel/base.rb @@ -5,9 +5,11 @@ module ActionCable include Callbacks include Redis - on_subscribe :start_periodic_timers + on_subscribe :start_periodic_timers on_unsubscribe :stop_periodic_timers + on_unsubscribe :disconnect + attr_reader :params class_attribute :channel_name @@ -54,6 +56,10 @@ module ActionCable # Override in subclasses end + def disconnect + # Override in subclasses + end + def broadcast(data) @connection.broadcast({ identifier: @channel_identifier, message: data }.to_json) end |