消息发布:
malloc出来一个Publish结构体,并赋值。
/**
* Data for a publish packet.
*/
typedef struct
{
Header header; /**< MQTT header byte */
char* topic; /**< topic string */
int topiclen;
int msgId; /**< MQTT message id */
char* payload; /**< binary payload, length delimited */
int payloadlen; /**< payload length */
int MQTTVersion; /**< the version of MQTT */
MQTTProperties properties; /**< MQTT 5.0 properties. Not used for MQTT < 5.0 */
uint8_t mask[4]; /**< the websockets mask the payload is masked with, if any */
} Publish;
调用 MQTTProtocol_startPublish,尝试发送
MQTTProtocol_startPublish
MQTTProtocol_startPublishCommon
MQTTPacket_send_publish