gpt4 book ai didi

ios - ActionCable、Rails 6 中的连接几秒钟后终止

转载 作者:行者123 更新时间:2023-11-29 05:14:03 24 4
gpt4 key购买 nike

当客户端进行订阅时,它会建立连接,开始接收 ping, channel 开始在服务器上传输,几秒钟后突然,连接终止,并显示错误消息“服务器重新启动”。我知道这条消息来自的文件是 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

连接.rb

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

最佳答案

所以这对我有用。全部与配置相关。

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

config.force_ssl = true
config.reload_classes_only_on_change = true

最重要的是
config.cache_classes = true

关于ios - ActionCable、Rails 6 中的连接几秒钟后终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59368239/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com