Module: ActionCable::Connection::Callbacks
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveSupport::Callbacks
- Included in:
- Base
- Defined in:
- lib/action_cable/connection/callbacks.rb
Overview
Action Cable Connection Callbacks
There are before_command
, after_command
, and around_command
callbacks available to be invoked before, after or around every command received by a client respectively. The term “command” here refers to any interaction received by a client (subscribing, unsubscribing or performing actions):
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :user
around_command :set_current_account
private
def set_current_account
# Now all channels could use Current.account
Current.set(account: user.account) { yield }
end
end
end
Defined Under Namespace
Modules: ClassMethods