Piping binary data through liveView socket

I need to pass some binary data from my server side to the client side. I could use a controller and HTTP, but the source of the data is inside my live view process, plus I don’t want to have separate auth for the controller. So right now I am doing push_event with some blob. For that to work I have to Base64 encode the data. I know this is not the best way to use liveView or the bandwidth, so my question is: is there a better way? I don’t want to have a separate process on the server side just to deal with the communication.

I think a while back there was talk of using a binary protocol in liveView instead of JSON. Is that still on the road map?

Channels support raw binary, but LV push_event does not. You could join a regular channel and push blobs as needed.

2 Likes

Thanks. For my need I don’t need much performance, so base64 encode/decode in the LV works ok. Is binary encoding instead of JSON still on the road map?