Tag: actioncable

Actioncable连接用户列表

我在ActionCable中validation用户是这样的: module ApplicationCable class Connection < ActionCable::Connection::Base identified_by :current_user def connect self.current_user = find_verified_user logger.add_tags 'ActionCable', current_user.name end protected def find_verified_user if verified_user = User.find_by(id: cookies.signed[:user_id]) verified_user else reject_unauthorized_connection end end end end 是否有可能获得连接用户列表? 我用谷歌搜索,但发现只有这个stackoverflow问题: 第一 , 第二

如何找出与ActionCable连接的人?

我见过ActionCable.server.open_connections_statistics , ActionCable.server.connections.length , ActionCable.server.connections.map(&:statistics) , ActionCable.server.connections.select(&:beat).count等等,不过这个只是“每个进程”(服务器,控制台,服务器工作者等)。 我如何找到目前订阅ActionCable的所有人 ? 这应该在每个环境(开发,登台,生产)中的任何Rails进程上返回相同的值。 例如,在开发控制台中,您还可以看到开发服务器上的连接,因为理论上它们使用相同的订阅适配器(redis,async,postgres)。 Rails 5.0.0.beta3,Ruby 2.3.0 相关的ActionCable – 如何显示已连接用户的数量?