(I'm the author of amf-cpp)
I've just added AMF3 packet support to amf-cpp. To use it, you have to create an AmfPacket
object, add headers (PacketHeader
) or messages (PacketMessage
) and then serialize the AmfPacket
. Here's a quick example (which assumes something like using namespace amf;
for brevity):
AmfPacket packet;
// first, we construct a simple header in-place
packet.headers.emplace_back(
"SomeHeader", // header name
false, // must understand?
AmfString("Value") // header value
);
// set up the message value
AmfObject object;
// add some properties
object.addSealedProperty("prop", AmfString("val"));
AmfArray content;
content.push_back(object);
// now construct the message in-place
packet.messages.emplace_back(
"com/example/Object.method", // target uri
"/1/onResult", // response-uri
content // value
);
// amf::v8 is a typedef for std::vector<uint8_t>
v8 data = packet.serialize();
The resulting data
object can then be used with your QDataStream
.
In the future, if you notice that amf-cpp is missing a feature you would like to use, feel free to open a bug report on the GitHub issue tracker.