Skip to Content Skip to Search

module ActionCable::Channel::Callbacks

Action Cable Channel Callbacks

Action Cable Channel provides callback hooks that are invoked during the life cycle of a channel:

Example

class ChatChannel < ApplicationCable::Channel
  after_subscribe :send_welcome_message, unless: :subscription_rejected?
  after_subscribe :track_subscription

  private
    def send_welcome_message
      broadcast_to(...)
    end

    def track_subscription
      # ...
    end
end

Inherits From

Namespace

Definition files