Action Cable Channel Callbacks

Action Cable Channel provides hooks during the life cycle of a channel subscription. Callbacks allow triggering logic during this cycle. Available callbacks are:

  • before_subscribe

  • after_subscribe (also aliased as: on_subscribe)

  • before_unsubscribe

  • after_unsubscribe (also aliased as: on_unsubscribe)

NOTE: the after_subscribe callback is triggered whenever the subscribed method is called, even if subscription was rejected with the reject method. To trigger after_subscribe only on successful subscriptions, use after_subscribe :my_method_name, unless: :subscription_rejected?

Namespace

Module

Included Modules