LabVIEW-Open-Source / LV-MQTT-Broker

Native LabVIEW MQTT Broker Server
Other
47 stars 13 forks source link

Publish Raw Payload #159

Closed jkoplo closed 4 years ago

jkoplo commented 4 years ago

@francois-normandin - would you consider extending your API to have a "Publish Raw Payload" on the MQTT Client class?

For my use case, I'm actually using two values - a header and a data payload to make my packet payload. I then merge them together into a single JSON object and send it. On the other side, they get separated and the header is turned back into a LV dataype, but the data payload is kept as a JSON string until later. In other words the payload datatype isn't known when I receive the MQTT packet on the other end.

I've managed to implement this in your existing library by creating a new Serializer that basically does nothing but check that it's passed a string (as a variant) and then stores/returns this string. This allows me to build my payload outside of the MQTT library and then pass it as a string to the variant input of the MQTT Publish. It's a pretty ugly hack.

jkoplo commented 4 years ago

And I just realized this belongs in the MQTT Client repo. I'll close this and copy the issue over there.