Ruby wamp客户端gem-连接到crossbar.io

Ruby wamp客户端gem-连接到crossbar.io,ruby,websocket,rubygems,crossbar,wamp-protocol,Ruby,Websocket,Rubygems,Crossbar,Wamp Protocol,我是红宝石新手 我正在尝试使用wamp客户端gem建立到crossbar.io路由器的连接。Crossbar具有通过Crossbar模板(python作为后端)创建的所有默认设置和应用程序。当我通过浏览器连接时,一切都很好,但当我试图通过简单的方式使用ruby时 require "wamp/client" wamp_test = WAMP::Client.new("ws://127.0.0.1:8080") wamp_test.open 我有一个“handle\u opening\u ha

我是红宝石新手

我正在尝试使用wamp客户端gem建立到crossbar.io路由器的连接。Crossbar具有通过Crossbar模板(python作为后端)创建的所有默认设置和应用程序。当我通过浏览器连接时,一切都很好,但当我试图通过简单的方式使用ruby时

require  "wamp/client"
wamp_test = WAMP::Client.new("ws://127.0.0.1:8080") 
wamp_test.open
我有一个“handle\u opening\u handshake\u response”:未处理的opening handshake response(Net::WS::Error)”错误。 我知道要处理握手,我的WAMP路由器应该发送HTTP 101交换协议,但它没有这样做(在wireshark中看不到)。 请帮帮我

客户请求:

GET / HTTP/1.1\r\n
Upgrade: websocket\r\n
Connection: Upgrade\r\n
Sec-Websocket-Key: RggxGCwmcnVuEB08UQMCWA==\r\n
Sec-Websocket-Version: 13\r\n
Sec-Websocket-Protocol: \r\n
Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\n
Accept: */*\r\n
User-Agent: Ruby\r\n
Host: localhost:8080\r\n
\r\n
Full request URI: http://localhost:8080/
HTTP request 1/1
路由器返回:

HTTP/1.1 200 OK\r\n
Server: Crossbar/0.11.1\r\n
Date: Mon, 01 Feb 2016 07:48:33 GMT\r\n
Cache-Control: max-age=43200, public\r\n
Expires: Mon, 01 Feb 2016 19:48:33 GMT\r\n
Accept-Ranges: bytes\r\n
Content-Length: 5085\r\n
Content-Type: text/html\r\n
Last-Modified: Thu, 28 Jan 2016 13:07:24 GMT\r\n
\r\n
HTTP response 1/1
Line-based text data: text/html
使用默认(生成的)Crossbar.io配置时,请尝试:
ws://127.0.0.1:8080/ws
,而不是
ws://127.0.0.1:8080
。WAMP WebSocket传输位于子路径上

您可以通过打开
http://127.0.0.1:8080
http://127.0.0.1:8080/ws
在浏览器中


另外:您的客户端未发送有效的WebSocket子目录列表(
Sec-WebSocket-Protocol
为空)。Crossbar.io有一个可接受的配置选项(假设
wamp.2.json
),但更好的行为是在您的WebSocket客户端库中激活WebSocket Subtocol协商。

我添加了wamp_test=wamp::client.new(“ws://127.0.0.1:8080/ws”,“subtocols=>[“wamp.2.json]”)现在Sec Websocket协议是wamp.2.json,但仍然没有连接-同样的错误。这个ruby gem很老了,所以我不确定它是否支持WAMPv2,看看谷歌快速搜索可以找到的WAMP的两个ruby实现,仅仅根据它们的年龄,它们都不支持WAMPv2。