bool InboundJSONCLIProtocol::SendMessage(Variant &message) { string json; if (!message.SerializeToJSON(json)) { FATAL("Unable to serialize to JSON"); return false; } json += "\r\n"; if (_useLengthPadding) { uint32_t size = EHTONL((uint32_t) json.length()); _outputBuffer.ReadFromBuffer((uint8_t *) & size, 4); } _outputBuffer.ReadFromString(json); return EnqueueForOutbound(); }
bool JsonVariantProtocol::Serialize(string &rawData, Variant &variant) { return variant.SerializeToJSON(rawData); }