0

私はherokuのレール5アプリにreactjsをデプロイしようとしています。これは私のProcfileです

web: bundle exec puma -C config/puma.rb

これは私の puma.rb ファイルです

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup      DefaultRackup
port        ENV['PORT']     || 5000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
  ActiveRecord::Base.establish_connection
end

これは私のcable.ymlファイルです

production:
:url: redis://redistogo:f9e8821e7e25167ae7023516bd3fce13@tarpon.redistogo.com:11879/
:host: tarpon.redistogo.com
:port: 11879
:password: xxxx
:inline: true
:timeout: 1

development:
  url: redis://localhost:6379/2

test:
  url: redis://localhost:6379/3

私はreactjsからソケットに接続しようとしています

App.cable = ActionCable.createConsumer("wss://adham-chatty.heroku.com");

しかし、クロムコンソールでこのエラーが発生し、ソケットが機能しません:\

WebSocket connection to 'wss://adham-chatty.heroku.com/' failed: WebSocket opening handshake was canceled

ここに私のHerokuログがあります

016-01-19T17:17:22.405051+00:00 heroku[web.1]: State changed from up to starting
    2016-01-19T17:17:25.031404+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb`
    2016-01-19T17:17:26.521202+00:00 heroku[web.1]: Stopping all processes with SIGTERM
    2016-01-19T17:17:27.266810+00:00 app[web.1]: [3] Puma starting in cluster mode...
    2016-01-19T17:17:27.266821+00:00 app[web.1]: [3] * Version 2.15.3 (ruby 2.2.2-p95), codename: Autumn Arbor Airbrush
    2016-01-19T17:17:27.266822+00:00 app[web.1]: [3] * Min threads: 5, max threads: 5
    2016-01-19T17:17:27.266822+00:00 app[web.1]: [3] * Environment: production
    2016-01-19T17:17:27.266823+00:00 app[web.1]: [3] * Process workers: 2
    2016-01-19T17:17:27.266823+00:00 app[web.1]: [3] * Preloading application
    2016-01-19T17:17:27.721211+00:00 app[web.1]: [3] - Gracefully shutting down workers...
    2016-01-19T17:17:28.101087+00:00 app[web.1]: [3] === puma shutdown: 2016-01-19 17:17:28 +0000 ===
    2016-01-19T17:17:28.101095+00:00 app[web.1]: [3] - Goodbye!
    2016-01-19T17:17:28.974002+00:00 app[web.1]: [3] * Listening on tcp://0.0.0.0:18058
    2016-01-19T17:17:28.974157+00:00 app[web.1]: [3] Use Ctrl-C to stop
    2016-01-19T17:17:28.978252+00:00 app[web.1]: [3] - Worker 0 (pid: 6) booted, phase: 0
    2016-01-19T17:17:28.994863+00:00 heroku[web.1]: Process exited with status 0
    2016-01-19T17:17:28.979382+00:00 app[web.1]: [3] - Worker 1 (pid: 10) booted, phase: 0
    2016-01-19T17:17:29.346266+00:00 heroku[web.1]: State changed from starting to up

私は何をすべきか?

4

1 に答える 1

0

ルートにconfig.action_cable.url& config.action_cable.allowed_request_origins& を設定する必要があり ますmount ActionCable.server

于 2016-07-29T16:40:05.550 に答える