Search code examples
autobahnratchetwamp-protocol

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


I am trying to put up a wamp connection from my local website. I used Ratchet/Wamp on the server side and autobahn|js on the client side. The service is running fine and I am able to connect, the onOpen/onClose callbacks are being triggered on the server.

But when I connect from the browser, the connection's onopen callback is never called. Instead, the console log shows the following:

"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

The InvalidAccessError is during a call to the close method on a websocket object that probably never got initialized properly, I'm hoping this goes away after I know what causes the main problem, about which I'm totally in the dark how to resolve at the moment.

Do you have an idea what's going on? Is there an incompatibility between the Ratchet I am using and Autobahn, perhaps? Both claim to adhere to the standard, but that's all I can think of right now, being new to the Wamp thing.


Solution

  • Ratchet is WAMP v1 (and their docs where written at a time when this was the only version, so they don't mention this). See https://github.com/ratchetphp/Ratchet/issues/168

    WAMP v1 is deprecated from our side (Crossbar.io/Autobahn project), since WAMP v2 offers much more features. There is an old version of Autobahn which supports WAMP v1 (see the above linked issue thread), but I would suggest you move to another WAMP router.

    My suggestion is, of course, Crossbar.io (since I'm part of the project), but there are others - see http://wamp-proto.org/implementations.