使用 C 客户端库 (libmosquitto)
如何将此 json 字符串发布到 MQTT mosquitto 代理
"book":[
{"Name":"xyz", "price":"5.00"},
{"Name":"abc", "price":"10.00"},
{"Name":"hello world", "price":"15.00"}
]}
using this function.
mosquitto_publish(mosq, NULL, "xyz", 10, "5.00", 2, false);
int mosquitto_publish( mosq, mid, topic, payloadlen, payload, qos, retain);