-
Notifications
You must be signed in to change notification settings - Fork 881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support alternative serialization formats #414
Comments
I think a more practical variant of this feature request could be for msgpack-c to support a SAX-style deserialization API. In https://github.com/tplgy/bonefish/blob/master/src/bonefish/serialization/json_serializer.cpp and https://github.com/tplgy/json-msgpack/blob/master/include/json_msgpack/json_msgpack_sax.hpp, I use RapidJSON's SAX API to read JSON and write directly into a For writing msgpack, the Packer API already is a SAX API that's entirely independent from @oberstet, if you want to keep |
@jpetso yes, I'd like to keep Ah, I see .. so instead of extending msgpack-c, you are converting at WAMP message level https://github.com/tplgy/bonefish/blob/master/src/bonefish/serialization/json_serializer.cpp |
There's really nothing WAMP-specific about it, except how to parse the JSON string for binary data, but that's pluggable. It spits out a |
My transport abstraction work includes some refactoring that will make On Thu, Jan 28, 2016 at 7:44 PM, Jakob Petsovits [email protected]
|
Note: In order to use You can build You can use
Here is a little documentation: |
Now I am confused;)
/// A map holding any values and string keys.
typedef std::map<std::string, boost::any> anymap;
/// A vector holding any values.
typedef std::vector<boost::any> anyvec;
/// A pair of ::anyvec and ::anymap.
typedef std::pair<anyvec, anymap> anyvecmap; After a long discussion, we switch to Are you suggesting to move to It's funny: in a way, this the kind of situation I wanted to avoid originally by choosing |
I just wanted to inform you the recent version of the
Let's sum up the information to make decision.
I don't know much about |
That was a main reason for switching from
"convert" sounds like double effort / memory. I guess my question is: how would I parse CBOR from the wire, while creating a native |
boost::any was not well suited for custom data types. The previous api Converting to other types in our case is no different than what was being What we have now is really no different than what we had before except that Before user-defined-type <=> boost::any <=> wire-format Now user-defined-type <=> msgpack::object <=> wire-format I think that regardless of what is chosen as the variant there will be an On Saturday, 30 January 2016, Tobias Oberstein [email protected]
|
@davidchappelle Thanks for reminding me of the other arguments there were for switching from Sidenote (opinionated): Why use a "user-defined-type" in the app in the first place? Why not use In above, I was more concerned that we might end up with:
Effectively putting JSON/CBOR second class (because of the necessary additional translation step in ()), and putting the translationg () code into And hence my question of natively supporting JSON and CBOR directly within
Would that be even feasible? @jpetso Is that what you hinted at with the
because having that would allow an efficient and cleanly separated implementation of the (*) translation? |
There is no need for msgpack-c to support any other serialization formats as part of the project as long as it offers interfaces for efficient packing and unpacking. Support for alternative formats can then be added as part of an independent project such as json-msgpack.
I filed msgpack-c #418 which has a slightly different focus than this issue but would take care of item 2. I also believe we have sorted out any remaining related issues in crossbario/autobahn-cpp#86. I think that means this issue can be closed, since there is nothing else to do that requires tracking by this issue specifically. Is that correct? If so, please close. |
One thing to also note here. Unmarshaling to a msgpack::object doesn't have On Wed, Feb 10, 2016 at 7:04 PM, Jakob Petsovits [email protected]
|
Thanks all for explaining / discussion. I am closing this issue as I was convinced the "actual itch" is better solved differently. |
autobahn-cpp is a WAMP client library, and uses
msgpack-c
to support MessagePack serialization variants of WAMP.WAMP in addition supports JSON and CBOR serialization formats. E.g. Crossbar.io, a WAMP router, supports all 3 serialization format, and is able to transparently translate between different serialization formats.
In
autobahn-cpp
, we had some discussions about how to support JSON and CBOR.One aspect that came up is that
msgpack-c
actually provides 2 things in 1:Eg
autobahn-cpp
was perviously using a Boost Variant type in it's public API, but now usesmsgpack-c
for that.I was wondering if we could retain 2. as a public API type in
autobahn-cpp
, while expanding 1. for supporting not only MessagePack, but also JSON and CBOR - transparently.Users of
autobahn-cpp
would continue programming usingmsgpack-c
types, and serialization format negotiation could happen dynamically and completely "under the hood" - without any user code changes.Is this something that has been considered for
msgpack-c
?The text was updated successfully, but these errors were encountered: