encodePayload static method
dynamic
encodePayload(
- List packets, {
- required dynamic callback(
- dynamic _
),
})
Implementation
static encodePayload(List packets, {required callback(_)}) {
final length = packets.length;
final encodedPackets = []..length = length;
var count = 0;
var i = 0;
packets.forEach((packet) {
// force base64 encoding for binary packets
encodePacket(packet, supportsBinary: false, callback: (encodedPacket) {
encodedPackets[i++] = encodedPacket;
if (++count == length) {
callback(encodedPackets.join(SEPARATOR));
}
});
});
}