Appendix A.5 - MQTT Buffer Length Handling
This section describes how to read MQTT data on a subscribed topic when the length is more than Read Threshold.
- In the RNWF11 MQTTC parameter, Read Threshold is set to 128 by default. Users can
set this value based on their requirements (such as 700) or retain the default
value. If any MQTT subscribe response exceeds this set value (Read Threshold), then
an additional MQTTSUBRD command is to be sent to read the complete SUBRX response.
To set the Read Threshold, use the following
command:
AT+MQTTC=9,<read_threshold>
For example, using the following command the user can retrieve the device twin properties:AT+MQTTPUB=0,0,0,"$iothub/twin/GET/?$rid=2",""
The user may get a similar response as following if length of payload is more than read_threshold:+MQTTSUBRX:0,0,0,"$iothub/twin/res/200/?$rid=2",0,180
Here, the last parameter is character count of the response, in this case it is 180, and
“$iothub/twin/res/200/?rid=2”
is the topic on which device twin data response was sent by the service. - To get the complete +MQTTSUBRX
response, send the following
command:
AT+MQTTSUBRD="$iothub/twin/res/200/?$rid=2",0,180