调用了paho_mqtt_subscribe函数没?要通过调用该函数,注册与Topic对应的回调。
或者,学习sample.c中的写法,用:
/* set subscribe table and event callback */
client.message_handlers[0].topicFilter = rt_strdup(MQTT_SUBTOPIC);
client.message_handlers[0].callback = mqtt_sub_callback;
client.message_handlers[0].qos = QOS1;
调用了paho_mqtt_subscribe函数没?要通过调用该函数,注册与Topic对应的回调。
或者,学习sample.c中的写法,用:
/* set subscribe table and event callback */
client.message_handlers[0].topicFilter = rt_strdup(MQTT_SUBTOPIC);
client.message_handlers[0].callback = mqtt_sub_callback;
client.message_handlers[0].qos = QOS1;
举报