Module: ActionCable::Channel::Callbacks::ClassMethods

Defined in:
lib/action_cable/channel/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#on_subscribe(*methods) ⇒ Object

Name methods that should be called when the channel is subscribed to. (These methods should be private, so they're not callable by the user).


16
17
18
# File 'lib/action_cable/channel/callbacks.rb', line 16

def on_subscribe(*methods)
  self.on_subscribe_callbacks += methods
end

#on_unsubscribe(*methods) ⇒ Object

Name methods that should be called when the channel is unsubscribed from. (These methods should be private, so they're not callable by the user).


22
23
24
# File 'lib/action_cable/channel/callbacks.rb', line 22

def on_unsubscribe(*methods)
  self.on_unsubscribe_callbacks += methods
end