Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 乘客侧、websocket轨道中的重复事件_Ruby On Rails_Ruby On Rails 3.2_Websocket_Passenger - Fatal编程技术网

Ruby on rails 乘客侧、websocket轨道中的重复事件

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

我使用的是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 = 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响应。