推送器无法建立连接

Pusher not able to establish connection

我正在尝试使用推送器连接到 Liquid 交易所的 Stream API。 Documentation here

我构建了一个符合 Pusher 库文档的函数。 Link to that here 我当前的代码如下所示:

require 'pusher-client'
channels_client = PusherClient::Socket.new('LIQUID', {
      ws_host: 'tap.liquid.com'
  })

和 运行ning 给我一条错误消息:

D, [2019-08-20Txx:xx:xx.xxxxxx #xxxxx] DEBUG -- : Binding pusher:connection_established to pusher_global_channel

D, [2019-08-20Txx:xx:xx.xxxxxx #xxxxx] DEBUG -- : Binding pusher:connection_disconnected to pusher_global_channel

D, [2019-08-20Txx:xx:xx.xxxxxx #xxxxx] DEBUG -- : Binding pusher:error to pusher_global_channel

D, [2019-08-20Txx:xx:xx.xxxxxx #xxxxx] DEBUG -- : Binding pusher:ping to pusher_global_channel

如果我在第一个命令后尝试 运行:

channels_client.connect

...它拒绝连接。

C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/pusher-client-0.6.2/lib/pusher-client/websocket.rb:17:in `initialize': No connection could be made because the target machine actively refused it. - connect(2) for "tap.liquid.com" port 80 (Errno::ECONNREFUSED)

错误来自tcpsocket.new (Ruby https://ruby-doc.org/stdlib-2.5.1/libdoc/socket/rdoc/TCPSocket.html) in websocket line 17: https://github.com/pusher-community/pusher-websocket-ruby/blob/master/lib/pusher-client/websocket.rb

ws_hosttap.liquid.com80好像无效,https://pusher.com/docs/channels/library_auth_reference/pusher-websockets-protocol

我已经尝试使用安全连接,至少在浏览器中,并且得到了 404 的 ws 和无效请求,这在这种情况下很好,对于 https (https://tap.liquid.com/)。

您需要在客户端配置中配置 ssl,但是 pusher-client gem 以及我发现的另一个都非常旧。也许切换到像 https://github.com/pusher/pusher-http-ruby/blob/master/README.md

这样的更新的库是明智的

该示例包含激活 SSL 的选项。