このような虹でprivate_pubを構成しました
虹.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.