AutobahnCPP: How to extract msgpack maps with the autobahn::wamp_event API?

#1

Hi,

I just started using Autobahn Cpp and it works (thanks for the added MSVC support!). However, I am now trying to subscribe to the ‘wamp.subscription.on_create’ event, published by the WAMP router itself. The callback function gets called, but my problem is to access the data published by the router. From inspection of the msgpack object, I can tell that there are two arguments, the first being an Integer value and the second being a map. Now my question is: with the existing interface, how do I access the map and it’s values? I’ve tried with the event.argument<std::map<std::string, std::string>>(1), but this leads to a msgpack exception for casting. I am not even sure if the map that is being published is actually of type <std::string, std::string>, i suspect that it contains mixed types (e.g. the id, url, … of the new subscriber). See also: https://github.com/crossbario/crossbar/blob/master/crossbar/router/broker.py#L402

Is there any example code available for the map datatype? The examples in the repository cover only “default” types such as std::string or integer values. I greatly appreciate any help or pointers into the right direction,

Best regards.

0 Likes