小编alx*_*bra的帖子

将auth_token发送给ActionCable进行身份验证

module ApplicationCable
  class Connection < ActionCable::Connection::Base
    identified_by :current_user

    def connect
      #puts params[:auth_token]
      self.current_user = find_verified_user
      logger.add_tags 'ActionCable', current_user.name
   end

  end
end
Run Code Online (Sandbox Code Playgroud)

我不使用web作为动作电缆的终点,所以我想使用auth_token进行身份验证.默认情况下,操作电缆使用会话用户标识进行验证 如何通过params连接方法?

ruby-on-rails-5 actioncable

16
推荐指数
4
解决办法
7400
查看次数

标签 统计

actioncable ×1

ruby-on-rails-5 ×1