-
Notifications
You must be signed in to change notification settings - Fork 273
Description
在调用 int mqtt_subscribe时;如果订阅后立即有数据下发,可能会出现无法接收到该数据帧的情况,这可能是订阅操作与消息处理机制之间的时序问题。可以在此函数调用MQTTSerialize_subscribe之前,先调用mqtt_msg_handler_create函数,如订阅失败再调用mqtt_msg_handler_destory,通过这种方式,可以确保在订阅动作执行前,消息处理机制已正确配置。个人意见,仅供参考
When calling int mqtt_subscribe; If data is delivered immediately after subscribing, there may be a situation where the data frame cannot be received, which may be a timing issue between the subscription operation and the message processing mechanism. You can call the mqtt_msg_handler_create function before this function calls MQTTSerialize_subscribe, and then call mqtt_msg_handler_destory if the subscription fails. This way, you can ensure that before the subscription action is executed, The message handling mechanism is configured correctly. Personal opinion, for reference only