灵药代码上的Websockets

时间:2017-08-05 02:26:58

标签: sockets websocket elixir

我目前正在使用elixir创建聊天。但无论何时我尝试运行应用程序,websocket都会在服务器控制台上出错

The client's requested channel transport version "2.0.0" does not match server's version requirements of "~> 1.0"

浏览器控制台:

WebSocket connection to 'ws://localhost:4000/socket/websocket token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJVc2VyOjMiLCJleHAiOjE1MDQ0OTE1NTQsImlhdCI6MTUwMTg5OTU1NCwiaXNzIjoiU2xpbmciLCJqdGkiOiIyNWY5NDZkNy1jNDg5LTRiYWMtYjJkNS0zZDA4OTdkNDU1ZWMiLCJuYmYiOjE1MDE4OTk1NTMsInBlbSI6e30sInN1YiI6IlVzZXI6MyIsInR5cCI6ImFjY2VzcyJ9.nh-DaQfY8OuI0EBE7lILFx6hjm6J_ZrynXHeOLr1-wM-fXnDakqrZUSN1XFQnr0x0KM9WFOkLEQnip5DcsKxXw&vsn=2.0.0' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

2 个答案:

答案 0 :(得分:1)

您的凤凰javascript库(依赖项)已更新,恕不另行通知。您应该修复版本,使其在package.json中限制为小于1.3.0(如果您使用的是npm)或bower.json,如果您使用bower来使用旧实现,或者如果您手动下载js文件则使用narrowtux解决方案。或升级凤凰版。

答案 1 :(得分:0)

With Phoenix 1.3, a new version of the transport protocol was released. It seems that you've somehow included the new version of the javascript client in your project, but are still running on Phoenix 1.2.

As a workaround, you can copy and reference the old client script here: https://github.com/phoenixframework/phoenix/blob/v1.2/web/static/js/phoenix.js