【问题标题】:Connection getting terminated after few seconds in ActionCable, Rails 6ActionCable,Rails 6中的连接在几秒钟后终止
【发布时间】:2019-12-17 05:48:53
【问题描述】:

当客户端订阅时,它建立连接,开始接收 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

【问题讨论】:

    标签: ios ruby-on-rails chat actioncable ruby-on-rails-6


    【解决方案1】:

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

    这些是我在 config/environments/development.rb 中所做的更改

    config.force_ssl = true
    config.reload_classes_only_on_change = true

    最重要的是
    config.cache_classes = true

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-25
      • 1970-01-01
      • 1970-01-01
      • 2016-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多