<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>MQTT-SN - Max payload length</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66486/mqtt-sn---max-payload-length</link><description>Hello, 
 I developed a code for nRF52840 Dongle to publish data on mqtt-sn topics (I&amp;#39;m currently using Nordic SDK for Thread and Zigbee). I need to know what are the limitations in terms on number of bytes that I can send over mqtt-sn in a single payload</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 29 Sep 2020 16:02:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66486/mqtt-sn---max-payload-length" /><item><title>RE: MQTT-SN - Max payload length</title><link>https://devzone.nordicsemi.com/thread/272123?ContentTypeID=1</link><pubDate>Tue, 29 Sep 2020 16:02:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d6e2dc3-f030-4908-a1fb-de601180afe5</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In section 5.2.1 of the&amp;nbsp;&lt;a href="https://www.oasis-open.org/committees/download.php/66091/MQTT-SN_spec_v1.2.pdf"&gt;MQTT-SN 1.2 specifications&lt;/a&gt;&amp;nbsp;it is mentioned that the header can have either 1 or 3-byte length fields for message length up to&amp;nbsp;65535 octets.&lt;/p&gt;
&lt;p&gt;The IEEE 802.15.4 packets support only up to 127 octets payload, but the 6LowPAN layer used in OpenThread supports fragmentation of IPv6 packets to allow larger payloads. See &lt;a href="https://www.threadgroup.org/Portals/0/documents/support/6LoWPANUsage_632_2.pdf"&gt;this document&lt;/a&gt; for more details on that.&lt;/p&gt;
&lt;p&gt;When it comes to what is supported in the Thread MQTT-SN examples in our SDK, I cannot find any limiting code. The source code shows that it supports both 1 and 3-byte lengths:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * Calculates the full packet length including length field
 * @param length the length of the MQTT-SN packet without the length field
 * @return the total length of the MQTT-SN packet including the length field
 */
int MQTTSNPacket_len(int length)
{
	return (length &amp;gt; 255) ? length + 3 : length + 1;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>