Module: ActionCable::Channel::Callbacks
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveSupport::Callbacks
- Included in:
- Base
- Defined in:
- actioncable/lib/action_cable/channel/callbacks.rb
Overview
Action Cable Channel Callbacks
Action Cable Channel provides callback hooks that are invoked during the life cycle of a channel:
- before_subscribe
- after_subscribe (aliased as on_subscribe)
- before_unsubscribe
- after_unsubscribe (aliased as on_unsubscribe)
Example
class ChatChannel < ApplicationCable::Channel
after_subscribe :send_welcome_message, unless: :subscription_rejected?
after_subscribe :track_subscription
private
def
broadcast_to(...)
end
def track_subscription
# ...
end
end
Defined Under Namespace
Modules: ClassMethods
Constant Summary
Constants included from ActiveSupport::Callbacks
ActiveSupport::Callbacks::CALLBACK_FILTER_TYPES
Method Summary
Methods included from ActiveSupport::Concern
append_features, class_methods, extended, included, prepend_features, prepended