MQTT Publish Max size

Hi there, 

We are using the default Serial LTE Modem application (2.2.0) and mfw1.3.2 on the nrf9160 so that we can control the device from an external MCU.

We are publishing data using the MQTT client with the #XMQTTPUB AT command. According to the documentation, the max publish size is 1024 bytes when not publishing in datamode. However, we are publishing in datamode (leaving the msg string empty).

Could you please advise what the maximum transmit size is when MQTT publishing using datamode? We can test this experimentally, but actual hard information on the limitation of this would be great.

Is this limited by the network MTU at all, or is the MQTT client firmware designed that if the publish payload is larger than the MTU, the payload will be split up into multiple packets?

Regards,

Frikkie

Parents
  • Hi Frikkie,

    Let's consider the maximum MQTT publish max size at different aspects.

    MQTT Specification: 256MB, but nobody will transfer such a big message due to the reasons explained here, especially for cellular IoT networt with low speed.

    MQTT Broker: It is decided by the MQTT broker owner, For AWS, you can send and receive messages up to 128 KB in size

    MQTT Client: This is mainly decided by hardware limitations like the flash and ram size. For MQTT publishing, MQTT messages can be divided into several TCP packages, so the limitation is mainly how much data datamode can receive before sending the MQTT message out, and it is 4KB(decided by datamode ring buffer size UART_DATA_SIZE 4096).

    Please also be aware that the TLS has a 2kB secure socket buffer size limitation according to the modem firmware release notes, you may encounter this issue when receiving an MQTT subscription message with a big size. 

    Best regards,

    Charlie

Reply
  • Hi Frikkie,

    Let's consider the maximum MQTT publish max size at different aspects.

    MQTT Specification: 256MB, but nobody will transfer such a big message due to the reasons explained here, especially for cellular IoT networt with low speed.

    MQTT Broker: It is decided by the MQTT broker owner, For AWS, you can send and receive messages up to 128 KB in size

    MQTT Client: This is mainly decided by hardware limitations like the flash and ram size. For MQTT publishing, MQTT messages can be divided into several TCP packages, so the limitation is mainly how much data datamode can receive before sending the MQTT message out, and it is 4KB(decided by datamode ring buffer size UART_DATA_SIZE 4096).

    Please also be aware that the TLS has a 2kB secure socket buffer size limitation according to the modem firmware release notes, you may encounter this issue when receiving an MQTT subscription message with a big size. 

    Best regards,

    Charlie

Children
Related