Faye允许您监视各种事件,例如handshake
或subscribe
。这些回调块仅提供client_id
值,而不是客户端本身。例如:如何获得给予客户ID的Faye客户?
server = Faye::RackAdapter.new(mount: '/faye', timeout: 45)
server.bind(:handshake) do |client_id|
puts "Received handshake from #{client_id}"
end
如何访问给定client_id
的客户端?或者如何在握手过程中访问更多信息,例如请求头中提供的cookie(如果该信息甚至可用)?