Connect with unsupported websocket subprotocol error

Hi Guys,

I am using autobahn/twisted lib to connect to an existing WAMP router that was implemented as part of another product, it was not implemented by myself. As such, the documentation I have is very limited. There is an existing client application as part of the package which is able to push messages (done via RPC)

I am currently trying a very simple session connect, but I am receiving the following error (shown in wireshark): ‘Connect with unsupported websocket subprotocol:wamp.2.cbor….”

Any ideas what I might be missing here? Any help is appreciated.

For testing, I was using the following code:

 from autobahn.twisted.component import Component
 from autobahn.twisted.component import run

 comp = Component(
     transports=u"ws://localhost:8080/ws",
     realm=u"realm1",
 )

 @comp.on_join
 def joined(session, details):
     print("session ready")

 if __name__ == "__main__":
     run([comp])

Note: I am currently developing this in an Ubuntu docker container which is not running on the same server as the WAMP Router.

Autobahn support multiple WAMP framings (eg websocket), transports (eg tcp) and serializers (eg cbor, json, msgpack, … and batched/unbatched).

An Autobahn client will by default announce all supported serializes via websocket subprotocols (when running over websocket), wamp.2.cbor being one of those, in a subprotocol list during the websocket opening handshake.

A websocket compliant WAMP router must select the first subprotocol from that list that is supported by the router - thus it should fallback eg to wamp.2.json automatically.

Apparently, it doesn’t do that …

@meejah do we already expose overriding the default list of serializers in Component for connecting clients?

a dirty trick could be: pip uninstall cbor cbor2 msgpack ubjson flatbuffers – which effectively leaves wamp.2.json as the only one Autobahn client will announce anyways

Hi @oberstet

Thanks for your suggestions. Unfortunately now, I just get the following errors:

connecting once using transport type "websocket" over endpoint "tcp"
2019-07-03T16:27:42+0000 Connection failed: RuntimeError: could not create serializer for "cbor" (available: ['flatbuffers', 'json', 'ubjson'])
2019-07-03T16:27:49+0000 Received SIGTERM, shutting down.
2019-07-03T16:27:49+0000 Main loop terminated.

@oberstet I just received this from one of the support team.

“the payload is noted in JSON for the transport. Please also check if you are using UTF-8 for the text coding.”

Is there a way of setting these on the component parameters?

EDIT:

Uninstalled ubjson too, now receiving error: Connect with unsupported websocket subprotocol:wamp.2.json.batched

Yes, Component supports all underlying options by passing options= for that transport; they are merely passed onwards to the transport so it should support any past and future options. That is, the very same “client side” options as documented e.g. for websocket https://crossbar.io/docs/WebSocket-Options/#available-options

For serializers specifically you can pass serializers= in the transport to specify a list of valid serializers. So, e.g., serializers=['json'] to use only JSON.

@meejah because I need to force json only in my client application. Do you have an example of where I would force this, with my above code? this isn’t immediately obvious.

The Component class only seems to take these parameters.

Pass serializers= as an option to a particular transport (part of the transports= list given to Component).

@meejah & @oberstet Legends! Thanks so much for your help!