Module: ActionCable::Channel::Callbacks::ClassMethods
- Defined in:
- actioncable/lib/action_cable/channel/callbacks.rb
Instance Method Summary collapse
-
#after_subscribe(*methods, &block) ⇒ Object
(also: #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.
- #after_unsubscribe(*methods, &block) ⇒ Object (also: #on_unsubscribe)
- #before_subscribe(*methods, &block) ⇒ Object
- #before_unsubscribe(*methods, &block) ⇒ Object
Instance Method Details
#after_subscribe(*methods, &block) ⇒ Object Also known 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?
60 61 62 |
# File 'actioncable/lib/action_cable/channel/callbacks.rb', line 60 def after_subscribe(*methods, &block) set_callback(:subscribe, :after, *methods, &block) end |
#after_unsubscribe(*methods, &block) ⇒ Object Also known as: on_unsubscribe
69 70 71 |
# File 'actioncable/lib/action_cable/channel/callbacks.rb', line 69 def after_unsubscribe(*methods, &block) set_callback(:unsubscribe, :after, *methods, &block) end |
#before_subscribe(*methods, &block) ⇒ Object
48 49 50 |
# File 'actioncable/lib/action_cable/channel/callbacks.rb', line 48 def before_subscribe(*methods, &block) set_callback(:subscribe, :before, *methods, &block) end |
#before_unsubscribe(*methods, &block) ⇒ Object
65 66 67 |
# File 'actioncable/lib/action_cable/channel/callbacks.rb', line 65 def before_unsubscribe(*methods, &block) set_callback(:unsubscribe, :before, *methods, &block) end |