Am I supposed decode the payload string myself? #1782
-
I can publish a string easily with
but am I not sure if this is the recommended way. Looks too clunky. I saw the example, and it was only using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@HubKing I've done a simple example available at https://github.com/CZEMacLeod/Tasmota-Mosquitto-MQTTnet-Sample I've shown number parsing using There are a couple of other little nice example bits in there too. Hope this helps. |
Beta Was this translation helpful? Give feedback.
@HubKing I've done a simple example available at https://github.com/CZEMacLeod/Tasmota-Mosquitto-MQTTnet-Sample
There is an extension method
ConvertPayloadToString
which may do what you want, but as many payloads are utf8 encoded numbers, or often utf8 json payloads, converting them to Strings is a lot of memory usage and copying.I've shown number parsing using
Utf8Parser
and Json decoding usingSystem.Text.Json
.There are a couple of other little nice example bits in there too. Hope this helps.