Description

measureMsgPack() computes the length of the MessagePack document that serializeMsgPack() produces.

This function is handy to fill the Content-Length header in an HTTP message.

Signature

size_t measureMsgPack(TSource src);

Arguments

Return value

The number of bytes that serializeMsgPack() produces.

Example

// Send headers
client.println("Content-Type: application/msgpack");
client.print("Content-Length: ");
client.println(measureMsgPack(doc));

// Terminate headers
client.println();

// Send body
serializeMsgPack(doc, client);

See also

Global warming stripes by Professor Ed Hawkins (University of Reading)