操作电缆无法解决生产中的握手问题

时间:2019-05-08 05:45:44

标签: ruby-on-rails-5 puma actioncable

动作电缆正在本地开发和生产模式,但不适用于生产。我正在使用docker和puma。我的#!/usr/bin/env puma environment ENV.fetch("RAILS_ENV") { "development" } workers 2 threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i threads threads_count / 2, threads_count app_dir = File.expand_path("../..", __FILE__) daemonize false preload_app! bind 'tcp://0.0.0.0:3000' bind "unix://#{app_dir}/tmp/sockets/puma.sock" # plugin :tmp_restart rackup DefaultRackup tag 'project_puma' before_fork do require 'puma_worker_killer' interval = (ENV.fetch("PUMA_WORKER_KILLER_INTERVAL") { 180 }).to_i PumaWorkerKiller.enable_rolling_restart(60 * interval) end on_worker_boot do ActiveSupport.on_load(:active_record) do ActiveRecord::Base.establish_connection end end on_restart do ActiveRecord::Base.connection_pool.disconnect! end 具有以下代码

cable.yml

development: adapter: redis url: redis://localhost:6379/1 test: adapter: async production: adapter: redis url: <%= ENV.fetch("REDIS_URL") { "redis://redis:6379/1" } %> channel_prefix: project_admin_production

production.rb

config.action_cable.url = "wss://mysite.com/cable" 中我有

Firefox can’t establish a connection to the server at ws://mysite.com/cable

在浏览器控制台中,我得到Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: close, HTTP_UPGRADE: )。在日志中,我可以看到错误rails 5.1.6, 我正在使用puma 3.4和{{1}}。我需要做些什么来解决此问题。

1 个答案:

答案 0 :(得分:0)

我可以通过将以下内容放入nginx config中来解决此问题

- (void)renderer:(id<SCNSceneRenderer>)renderer didAddNode:(SCNNode *)node forAnchor:(ARAnchor *)anchor 
{
     [node addChildNode: your3DObjectNode];
}