encodeMicroMessage method
Encodes a micro-message payload into a base64 string suitable for embedding in the endpoint name.
Returns null if the payload is too large to fit in the available byte budget after encoding the base metadata.
Implementation
String? encodeMicroMessage(
List<int> payload, {
required String nodeId,
required NodeRole role,
List<String>? groupIds,
}) {
final encoded = base64Encode(payload);
final available = availableMicroBytes(
nodeId: nodeId,
role: role,
groupIds: groupIds,
);
if (encoded.length > available || available <= 0) return null;
return encoded;
}