In Salesforce we fire a platform event and add a payload to a field Payload__c (LongText)to this platform event.
We created a streaming client in python which subscribes to this platform event and consumes the payload.
Because sometimes the payload is quite big, we came up with the idea to compress on salesforce side and decompress the payload on the python side.
We found the lib https://github.com/bilalfastian/LZ4String for Apex. So what we are currently doing is to compress the payload with the method: compressToBase64(payload) and store it as base64 in the platform event.
In python we tried in different ways but we where not able to decompress. Example with lib https://github.com/eduardtomasek/lz-string-python:
In Apex:
String test = 'Hello world';
String comp = LZString.compressToBase64 (test);
System.debug(comp);
// Output is 0oXjgLbmg7ZA7rqQ4pyw04gA
Now i try to decompress this string in python:
base64_message = '0oXjgLbmg7ZA7rqQ4pyw04gA'
w=x.decompresFromBase64(base64_message)
logger.error(w)
Output is just: -