ecorm / cppwamp

C++ client library for the WAMP protocol.
Boost Software License 1.0
35 stars 9 forks source link

Provide support for byte arrays #50

Closed ecorm closed 9 years ago

ecorm commented 9 years ago

The Binary conversion of JSON Strings section of the WAMP spec describes how to encode/decode byte arrays.

For MsgPack, the BIN format should be used.

wamp::Variant would have be to extended with another bound type to contain byte arrays. std::vector<uint8_t> seems like a good candidate.

ecorm commented 9 years ago

Open-source code for Base64 conversion is available here. It has a BSD style license and is small enough to be incorporated directly into the CppWAMP source tree. I noticed that it's being used by Cereal.

ecorm commented 9 years ago

This is now implemented (release pending). Variant now has a Blob field in its discriminated union, with Blob being a wrapper around a std::vector<uint8_t>. Base64 encoding/decoding for JSON has been written from scratch so that encoded messages can be written directly to TransportBuffer objects.