<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[wolfSSL - Embedded SSL Library — wolfMQTT Published Message Incomplete]]></title>
		<link>https://www.wolfssl.com/forums/topic1769-wolfmqtt-published-message-incomplete.html</link>
		<atom:link href="https://www.wolfssl.com/forums/feed-rss-topic1769.xml" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in wolfMQTT Published Message Incomplete.]]></description>
		<lastBuildDate>Tue, 06 Jul 2021 21:18:32 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: wolfMQTT Published Message Incomplete]]></title>
			<link>https://www.wolfssl.com/forums/post6129.html#p6129</link>
			<description><![CDATA[<p>Eric,</p><div class="codebox"><pre><code>mqttPublish.total_len </code></pre></div><p> solved the issue.</p><p>Thank you very much for your help.</p>]]></description>
			<author><![CDATA[null@example.com (rlev)]]></author>
			<pubDate>Tue, 06 Jul 2021 21:18:32 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post6129.html#p6129</guid>
		</item>
		<item>
			<title><![CDATA[Re: wolfMQTT Published Message Incomplete]]></title>
			<link>https://www.wolfssl.com/forums/post6125.html#p6125</link>
			<description><![CDATA[<p>Thank you for feedback Eric.<br />I will check and let you know.</p>]]></description>
			<author><![CDATA[null@example.com (rlev)]]></author>
			<pubDate>Wed, 30 Jun 2021 17:24:02 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post6125.html#p6125</guid>
		</item>
		<item>
			<title><![CDATA[Re: wolfMQTT Published Message Incomplete]]></title>
			<link>https://www.wolfssl.com/forums/post6120.html#p6120</link>
			<description><![CDATA[<p>Hi rlev,</p><p>Are you setting `mqttPublish.total_len` to the return value of snprintf?</p><p>Try checking in the application that the expected length is equal to the value of `mqttPublish.total_len` before calling `MqttClient_Publish`.</p><p><a href="https://github.com/Microchip-MPLAB-Harmony/net_apps_pic32mz/blob/ab672bd9dd52d8cf849563fd4139c0606969f4e6/apps/wolfmqtt_demo/firmware/src/app_mqtt_task.c#L480">https://github.com/Microchip-MPLAB-Harm … ask.c#L480</a></p><p>The MCH example uses strlen to set the payload length, so if your application is sending JSON data, it&#039;s possible that some NULL is causing an invalid length calculation.</p><p>Thanks,<br />Eric @ wolfSSL Support</p>]]></description>
			<author><![CDATA[null@example.com (embhorn)]]></author>
			<pubDate>Mon, 28 Jun 2021 16:03:20 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post6120.html#p6120</guid>
		</item>
		<item>
			<title><![CDATA[wolfMQTT Published Message Incomplete]]></title>
			<link>https://www.wolfssl.com/forums/post6116.html#p6116</link>
			<description><![CDATA[<p>Hi Forum,</p><p>I am using wolfMQTT and MPLABX Harmony 3 with the NET-GLUE (<a href="https://github.com/Microchip-MPLAB-Harmony/net/blob/master/third_party_adapter/wolfMQTT/src/mqtt_net_glue.h">https://github.com/Microchip-MPLAB-Harm … net_glue.h</a>)</p><p>Using these configuration values :<br /></p><div class="codebox"><pre><code>#define APP_MQTT_MAX_PUBLISH_MESSAGE_SIZE   1024
#define APP_MQTT_TX_BUFF_SIZE       2048
#define APP_MQTT_RX_BUFF_SIZE       2048
#define APP_MQTT_DEFAULT_QOS            MQTT_QOS_0</code></pre></div><p>The message to publish is a JSON string which is passed / filled to the mqtt context object publish buffer using snprintf :<br /></p><div class="codebox"><pre><code>snprintf(mqttCtx-&gt;publishMessage, APP_MQTT_MAX_PUBLISH_MESSAGE_SIZE + 1, MQTT_HW_TOPIC_PAYLOAD_TEMPLATE,
        field1,
        field2,
        ...
        ...
        fieldN);</code></pre></div><p>Total length json string is about <strong>298 characters</strong>.</p><p>To publish the message I execute :<br /></p><div class="codebox"><pre><code>resCode = MqttClient_Publish(&amp;mqttCtx-&gt;mqttClient, &amp;mqttCtx-&gt;mqttPublish);
            if (resCode == MQTT_CODE_CONTINUE)
            {
                break;
            }</code></pre></div><p>The message is published successfully but the receiving broker receives <strong>randomly some messages incomplete</strong>.<br />Most of the time the message has LAST character missing or an extra null character at the END.</p><p>Is correct to fill &quot;<strong>mqttCtx-&gt;publishMessage</strong>&quot; buffer using snprintf or am I doing something wrong?</p><p>Any help is appreciated it.</p><p>Thanks</p>]]></description>
			<author><![CDATA[null@example.com (rlev)]]></author>
			<pubDate>Fri, 25 Jun 2021 21:29:10 +0000</pubDate>
			<guid>https://www.wolfssl.com/forums/post6116.html#p6116</guid>
		</item>
	</channel>
</rss>
