在Private_pub和彩虹配置中配置问题

时间:2013-06-03 17:18:37

标签: ruby-on-rails-3 unicorn faye private-pub rainbows

我已经使用像这样的彩虹配置了private_pub

rainbows.conf:

Rainbows! do 


end 

private_pub.ru:

require "bundler/setup"
require "yaml"
require "faye"
require "private_pub"
require "faye/redis"


Faye::WebSocket.load_adapter('rainbows')
yml = YAML::load_file("config/private_pub_redis.yml")[ENV["RAILS_ENV"] || "development"]
PrivatePub.load_config(File.expand_path("../config/private_pub.yml", __FILE__), ENV["RAILS_ENV"] || "development")
run PrivatePub.faye_app(:timeout => 1, :engine => {
  :type  => Faye::Redis,
    :host  => yml["server"],
    :port  => yml["port"]
})

我使用这个运行服务器:

rainbows private_pub.ru -c config/rainbows.conf -E production -p 9292

现在每次页面加载订阅时都会收到此错误,订阅失败:

在浏览器上加载页面时的服务器错误日志:

E, [2013-06-03T22:29:10.673828 #17953] ERROR -- : app error: undefined method call' for nil:NilClass (NoMethodError)
E, [2013-06-03T22:29:10.674195 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/faye-websocket-0.4.7/lib/faye/websocket.rb:143:ininitialize'
E, [2013-06-03T22:29:10.674343 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/faye-0.8.9/lib/faye/adapters/rack_adapter.rb:131:in new'
E, [2013-06-03T22:29:10.674465 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/faye-0.8.9/lib/faye/adapters/rack_adapter.rb:131:inhandle_websocket'
E, [2013-06-03T22:29:10.674563 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/faye-0.8.9/lib/faye/adapters/rack_adapter.rb:88:in call'
E, [2013-06-03T22:29:10.674642 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/rainbows-4.5.0/lib/rainbows/max_body.rb:66:inblock in call'
E, [2013-06-03T22:29:10.674717 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/rainbows-4.5.0/lib/rainbows/max_body.rb:59:in catch'
E, [2013-06-03T22:29:10.674790 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/rainbows-4.5.0/lib/rainbows/max_body.rb:59:incall'
E, [2013-06-03T22:29:10.674863 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/rainbows-4.5.0/lib/rainbows/process_client.rb:44:in process_loop'
E, [2013-06-03T22:29:10.674937 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/rainbows-4.5.0/lib/rainbows/base.rb:32:inprocess_client'
E, [2013-06-03T22:29:10.675015 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:632:in worker_loop'
E, [2013-06-03T22:29:10.675099 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/rainbows-4.5.0/lib/rainbows/http_server.rb:45:inworker_loop'
E, [2013-06-03T22:29:10.675172 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:500:in spawn_missing_workers'
E, [2013-06-03T22:29:10.675243 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/rainbows-4.5.0/lib/rainbows/http_server.rb:61:inspawn_missing_workers'
E, [2013-06-03T22:29:10.675315 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:142:in start'
E, [2013-06-03T22:29:10.675387 #17953] ERROR -- : /var/lib/gems/1.9.1/gems/rainbows-4.5.0/bin/rainbows:127:in'
E, [2013-06-03T22:29:10.675458 #17953] ERROR -- : /usr/local/bin/rainbows:23:in load'
E, [2013-06-03T22:29:10.675529 #17953] ERROR -- : /usr/local/bin/rainbows:23:in'

浏览器控制台错误登录:

GET http://localhost:9292/faye?message=%5B%7B%22channel%22%3A%22%2Fmeta%2Fhands…3A%5B%22callback-polling%22%5D%2C%22id%22%3A%221%22%7D%5D&jsonp=__jsonp1__ 400 (Bad Request) faye.js:1
WebSocket connection to 'ws://localhost:9292/faye' failed: Unexpected response code: 500 http://localhost:8080/
WebSocket connection to 'ws://localhost:9292/faye' failed: WebSocket is closed before the connection is established.

1 个答案:

答案 0 :(得分:0)

对于遇到相同问题的任何人,答案都在这里:https://groups.google.com/forum/#!topic/faye-users/oQ5JCoV7qh8

这里的问题是我使用旧版本的faye-websocket。

另一个问题是我使用彩虹4.5而faye [0.8]支持更老的彩虹