rved channel id, 0 , which is a meta data channel for
application level. This channel payload is JSON or MessagePack encoded. If no
payload is present, this is a namespace reset, which will remove n
A
All message ids of 0 are designated "Meta Data". This means the
payload is encoded either in a JSON array or object or as a MessagePack
structure
This gives the fast encoding/decoding of simple t
icks MessagePack or JSON as required,
as long as the encoded values are are map or array types.
It is recommended that general structured data in other message ids also either
JSON or MessagePack als
====================
#
# Structured or meta data messages are always of id 0. They
#
use Cpanel::JSON::XS;
use Data::MessagePack;
my $mp=Data::MessagePack->new();
$mp->prefer_integer(1);
$mp->utf8(1
ack("C", $payload)) {
if (!$force_mp and ($_== 0x5B || $_== 0x7B)) {
#JSON encoded string
$decodedMessage=decode_json($payload);
}
else {
#msgpack encoded
$decodedMessage=$mp->unp
ack($payload);
}
}
$decodedMessage;
}
# Arguments: payload, force_mp
sub encode_meta_payload {
$_[1]?$mp->encode($_[0]):encode_json($_[0]);
}
1;