我正在使用带api导轨的动作电缆。
Action Cable在开发服务器上工作正常。但是,当我们在生产服务器上上传所有Action Cable进程时,它无法正常工作。
我在我的production.rb文件中使用以下配置:
config.action_cable.mount_path = nil
config.action_cable.url = ENV['ACTION_CABLE_URL_PRO']
config.action_cable.allowed_request_origins = [ENV['ACTION_ALLOWED_ORIGIN_PRO'],/http:\/\/example.*/]
conf
config.action_cable.disable_request_forgery_protection = true
routes.rb文件
mount ActionCable.server => '/cable'
Cable.yml
development:
adapter: redis
url: redis://localhost:6379/0
channel_prefix: App_development
test:
adapter: async
url: redis://localhost:6379/0
channel_prefix: App_development
production:
adapter: redis
url: redis://localhost:6379/1
channel_prefix: App_production
这使我在具有多个用户的Rails生产服务器上出现错误:
忽略在关闭WebSocket之后处理的消息,而且在应用程序端,还会出现错误 onFailedcom.hosopy.actioncable.ActionCableException:java.net.SocketTimeoutException:timeout