encodePayload static method
dynamic
encodePayload(})
Implementation
static encodePayload(List packets,
{bool supportsBinary = false,
required dynamic Function(dynamic t) callback}) {
if (supportsBinary && hasBinary(packets)) {
return encodePayloadAsBinary(packets, callback);
}
if (packets.isEmpty) {
return callback('0:');
}
encodeOne(packet, dynamic Function(dynamic t) doneCallback) {
encodePacket(packet, supportsBinary: supportsBinary, utf8encode: false,
callback: (message) {
doneCallback(_setLengthHeader(message));
});
}
map(packets, encodeOne, (results) {
return callback(results.join(''));
});
}