由于 ratchet/wamp 和高速公路的标准最新版本的协议冲突,wamp 连接失败

wamp connection failing due to protocol violation with standard recent versions of ratchet/wamp and autobahn

我正在尝试从我的本地网站建立一个 wamp 连接。我在服务器端使用了Ratchet/Wamp,在客户端使用了autobahn|js。服务 运行 正常,我可以连接,正在服务器上触发 onOpen/onClose 回调。

但是当我从浏览器连接时,永远不会调用连接的 onopen 回调。相反,控制台日志显示以下内容:

"AutobahnJS debug enabled" autobahn.js:123:6
"Ok, Autobahn loaded" "0.9.9" wamp.php:28:1
"trying to create WAMP transport of type: websocket" autobahn.js:732:6
"using WAMP transport type: websocket" autobahn.js:732:6
Array [ 1, "blablaRealm", Object ] autobahn.js:732:6
"WebSocket transport send" "[1,"blablaRealm",{"roles":{"caller":{"features":{"caller_identification":true,"progressive_call_results":true}},"callee":{"features":{"caller_identification":true,"pattern_based_registration":true,"shared_registration":true,"progressive_call_results":true,"registration_revocation":true}},"publisher":{"features":{"publisher_identification":true,"subscriber_blackwhite_listing":true,"publisher_exclusion":true}},"subscriber":{"features":{"publisher_identification":true,"pattern_based_subscription":true,"subscription_revocation":true}}}}]" autobahn.js:732:6
"WebSocket transport receive" "[0,"19232286535719350273b26118584308",1,"Ratchet\/0.3.4"]" autobahn.js:732:6
"failing transport due to protocol violation: unexpected message type 0" autobahn.js:732:6
InvalidAccessError: A parameter or an operation is not supported by the underlying object autobahn.js:5308:0

InvalidAccessError 是在调用 websocket 对象的 close 方法期间可能从未正确初始化的,我希望在我知道导致主要问题的原因后它会消失,我完全在天黑目前怎么解决。

你知道发生了什么事吗?我正在使用的 Ratchet 和 Autobahn 之间是否存在不兼容性?两者都声称遵守标准,但这是我现在能想到的全部,是 Wamp 的新手。

Ratchet 是 WAMP v1(他们的文档是在当时只有这个版本的情况下编写的,所以他们没有提到这一点)。参见 https://github.com/ratchetphp/Ratchet/issues/168

WAMP v1 已被我们(Crossbar.io/Autobahn 项目)弃用,因为 WAMP v2 提供了更多的功能。有一个旧版本的 Autobahn 支持 WAMP v1(请参阅上面链接的问题线程),但我建议您移动到另一个 WAMP 路由器。

我的建议当然是 Crossbar.io(因为我是项目的一部分),但还有其他建议 - 请参阅 http://wamp-proto.org/implementations