cocaine/cocaine-framework-native — pull request #7 by sergeypxyz (2014-03-13 15:11:56+00:00)
Title: Add functions to send already packed data

I need to send complex data (map with multiple value types) like

{"method":"login","params":{"login":"user","password":"pass"}}

I cannot do it with existing methods due to limitations of std::map (single value type). To pack into a map with multiple value types, I use custom code like

msgpack::sbuffer buf;
msgpack::packer pk(&buf);
pk.pack_map(2);
pk.pack(std::string("method"));
pk.pack(std::string("login"));
pk.pack(std::string("params"));
pk.pack_map(2);
pk.pack(std::string("login"));
pk.pack(std::string("user"));
pk.pack(std::string("password"));
pk.pack(std::string("pass"));
auto g=auth_app->enqueue_prepacked("process_request",buf);

where the last line calls one of the methods I propose.