Action Cable 连接回调
向客户端发送命令(例如订阅、取消订阅或执行操作)时,将调用 before_command、after_command 和 around_command 回调。
示例
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
命名空间
包含的模块