What is the maximum payload length of MQTT-SN packet over UDP? The UDP does support 65507 bytes of data on its payload, but I wanted know what's the max size of MQTT-SN payload. Also, can the data be compressed in the MQTT-SN payload?
The MQTT-SN protocol spec can be found here
Section 5 talks about the message format and section 5.2 talks about how the header is made up.
There is the length field which can be 1 or 3 bytes long followed by the message type byte. Then a number of fields depending on the type of message.
The 3 byte size can represent a max total message of 65535 bytes
Assuming a Publish, then section 5.4.12 has the format for a publish message. Also assuming you are using topic ids rather than full text topics. The header will be 9 bytes in size (assuming you want a large message so 3 byte size needed) this means the max payload can be 65498 bytes. But this is a protocol upper limit, the actual limit will be constrained by the networks MTU.