Skip to main content

Compression

Each message between a third party client and Broadcast servers has to be compressed using Zlib Library. Zlib is industry standard compression library available for any platform. Header Packet of Five character needs to prefix with all Compress Message.

🔒 How to encode the Message:

  • First form message to be send over socket as mentioned in section 4.3.

  • Compress above message formed using zlib library and append 6 bytes at start with firs byte value = 5, next 5 byte will length of the compress message. E.g.,

HeaderMessage
500073Compressed Dat

🔓 How to decode the Message:

  • The first bytes of the broadcast packet indicate the whether message is compressed or not. If first byte contain 5(♣) then message is compressed message and if it contain 2(☻) then it is uncompressed message.

  • Next 5 byte indicate the length of message.

  • In case of multiple message, Each message contain header and non-compressed message.

HeaderMessage
500073Compressed Data

⬇️

Header1Message1Header2Message2
200253Uncompressed data200278Uncompressed data