【问题标题】:ActionCable not transmitting the messageActionCable 不传输消息
【发布时间】:2017-10-13 20:39:42
【问题描述】:

我在 rails 5 中实现 action cable,它在本地运行良好,但在登台和生产中,将消息发送到 action cable rails logger 后是 thi。

[ActionCable] Broadcasting to chats_4: {:id=>"message_97", :message=>"88", :user=>"John", :time=>"15-May-17 06:38 am", :chatroom_id=>4, :file=>nil}

但它没有传输给订阅者,浏览器控制台给出错误

Firefox can’t establish a connection to the server at wss://demo.xyz.com/cable.
The connection to wss://demo.xyz.com/cable was interrupted while the page was loading.

我的环境配置如下。

 config.action_cable.url = "wss://demo.xyz.com/cable"
 config.action_cable.allowed_request_origins = ['https://demo.xyz.com', 'http://demo.xyz.com']

我将应用程序托管在乘客 + nginx 中

location /cable {
          passenger_app_group_name xyz_websocket;
           passenger_force_max_concurrent_requests_per_process 0;
         }

我的 nginx 日志说

2017/05/15 06:43:30 [error] 13412#0: *675 open() "/home/test/apps/xyz/current/public/cable" failed (2: No such file or directory), client: 103.xix.204.xx, server: https://demo.xyz.com, request: "GET /cable HTTP/1.1", host: "demo.xyz.com"

帮我解决这个问题。

【问题讨论】:

    标签: ruby-on-rails ruby passenger ruby-on-rails-5 actioncable


    【解决方案1】:

    可以阅读有关设置 here 的更多信息,但我会确保您单独安装有线服务器 - 这听起来像是“乘客实际上坚持将其作为单独的进程运行”

    【讨论】:

    • 我也实现了
    猜你喜欢
    • 2016-09-21
    • 1970-01-01
    • 2011-08-06
    • 1970-01-01
    • 2018-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多