Skip to Content Skip to Search

module ActionCable::Channel::Callbacks::ClassMethods

Public instance methods

Also aliased as: on_subscribe.

This callback will be triggered after the Base#subscribed method is called, even if the subscription was rejected with the Base#reject method.

To trigger the callback only on successful subscriptions, use the Base#subscription_rejected? method:

after_subscribe :my_method, unless: :subscription_rejected?
Source code GitHub
# File actioncable/lib/action_cable/channel/callbacks.rb, line 60
def after_subscribe(*methods, &block)
  set_callback(:subscribe, :after, *methods, &block)
end

Also aliased as: on_unsubscribe.

Source code GitHub
# File actioncable/lib/action_cable/channel/callbacks.rb, line 69
def after_unsubscribe(*methods, &block)
  set_callback(:unsubscribe, :after, *methods, &block)
end
Source code GitHub
# File actioncable/lib/action_cable/channel/callbacks.rb, line 48
def before_subscribe(*methods, &block)
  set_callback(:subscribe, :before, *methods, &block)
end
Source code GitHub
# File actioncable/lib/action_cable/channel/callbacks.rb, line 65
def before_unsubscribe(*methods, &block)
  set_callback(:unsubscribe, :before, *methods, &block)
end

Alias for: after_subscribe.

Alias for: after_unsubscribe.

Definition files