Ruby on rails 乘客侧、websocket轨道中的重复事件
我使用的是phusion乘客版4.0.35 我的websocket_rails.rb文件Ruby on rails 乘客侧、websocket轨道中的重复事件,ruby-on-rails,ruby-on-rails-3.2,websocket,passenger,Ruby On Rails,Ruby On Rails 3.2,Websocket,Passenger,我使用的是phusion乘客版4.0.35 我的websocket_rails.rb文件 WebsocketRails.setup do |config| config.log_level = :debug config.log_internal_events = false if Rails.env.production? config.standalone = true else config.standalone = false end config.synchronize = fal
WebsocketRails.setup do |config|
config.log_level = :debug
config.log_internal_events = false
if Rails.env.production?
config.standalone = true
else
config.standalone = false
end
config.synchronize = false
end
在一个普通的控制器中,我是这样使用的
connection1 = WebsocketRails.users[one_user_id]
connection1.send_message :online, @reply.to_json(:methods => required_methods)
connection2 = WebsocketRails.users[another_other_user_id]
connection2.send_message :online, @reply.to_json(:methods => required_methods)
在客户端
var socket_path = document.domain + ":3001" + '/websocket'
var dispatcher = new WebSocketRails(socket_path)
dispatcher.bind('online', function(data){
.................
..................................
}
问题是,当我在控制器上调用send_message时,我得到了两次响应。两个用户都得到了两次响应
另一件事是,它在正常服务器模式下的开发中工作得非常好,运行在瘦服务器上。您能使用.deliver功能吗
这将帮助您并让我知道这个问题根本不是关于ActionMailer的。是的,这个问题是关于ActionMailer的。它与实时推送通知系统相关,而在我的例子中,客户端从服务器接收json响应。