Broadcasting binary data to PubSub

I tracked down the bloat in sending compressed data to the PubSub. Compressing gives binary data. The binary data has to convert to Base64 to send through a JSON message. That bloats the payload by 30%.

What’s the API limits for

Is it still 1 request per second and 6kb?

Before Base64, the data is under 5kb.

Is there a way to submit binary data through this endpoint?

I found another compression trick after some experiments.

I’m using RGB values with int arrays and compressing that.

I thought well I could combine RGB down to 24 bits and pack the data tighter by using ints to hold two partial colors. I.e.

1: RGB R
2: GB RG
3: B RGB

The idea is I’d be recovering the 30% by packing data into a more compact space.

The result is the compressed zip size doubled.


So I went the other way. I separated each RGB in into red, green, blue array items.

The code is less complex and the size dropped to 5kb.

Well… that works. Indirectly achieved the desired result.