# File actioncable/lib/action_cable/channel/callbacks.rb, line 60 def after_subscribe(*methods, &block) set_callback(:subscribe, :after, *methods, &block) end
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?
# File actioncable/lib/action_cable/channel/callbacks.rb, line 69 def after_unsubscribe(*methods, &block) set_callback(:unsubscribe, :after, *methods, &block) end
# File actioncable/lib/action_cable/channel/callbacks.rb, line 48 def before_subscribe(*methods, &block) set_callback(:subscribe, :before, *methods, &block) end
# File actioncable/lib/action_cable/channel/callbacks.rb, line 65 def before_unsubscribe(*methods, &block) set_callback(:unsubscribe, :before, *methods, &block) end
© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.