与 ip 绑定后 Action Cable 不工作

Action Cable not working after binding with ip

我已经在我的系统中实现了 rails-5 的动作电缆,它在 localhost 上工作正常,但是当我尝试绑定 ip 时,它给出了以下错误消息。

WebSocket connection to 'ws://192.168.1.46:3002/cable' failed: Error during WebSocket handshake: Unexpected response code: 404

并在终端日志中

Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)

我已经对我的development.rb进行了更改

config.action_cable.url = "ws://192.168.1.46:3002/cable"

但没有成功。

请指导我哪里错了。

如果您需要更多信息,请告诉我,提前致谢。

将下行添加到 config/environments/development.rb 文件

config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/]

希望对您有所帮助。