ActionCable 中的连接在几秒后终止,Rails 6

Connection getting terminated after few seconds in ActionCable, Rails 6

当客户端来订阅时,它建立连接,开始接收 ping,频道开始在服务器上传输,几秒钟后突然,连接终止并显示错误消息“服务器重启” .我知道发出此消息的文件是 https://github.com/rails/rails/blob/f675cb30ce813a99b52b139a93e048330922fd9a/actioncable/lib/action_cable/server/base.rb#L41

但我不明白为什么会这样。此外,这不会发生在我的本地机器上,它发生在其他服务器 运行 开发环境

config/cable.yml

development:  
  adapter: redis  
  url: redis://localhost:6379  

qa:  
  adapter: async  

stage:  
  adapter: async  

test:  
  adapter: test

connection.rb

module ApplicationCable  
  class Connection < ActionCable::Connection::Base  
  end  
end

所以这对我有用。都和配置有关。

这些是我在 config/environments/development.rb

中所做的更改

config.force_ssl = 真
config.reload_classes_only_on_change = 真

最重要的是
config.cache_classes = 真