MQTT::collect

Description

This command collects the specified amount of MQTT message payload data before triggering a MQTT_CLIENT_DATA or MQTT_SERVER_DATA event.
When collecting data in a clientside event, the MQTT_CLIENT_DATA event will be triggered. When collecting data in a serverside event, the MQTT_SERVER_DATA event will be triggered.
This command is valid only for the PUBLISH MQTT message type and allows you to perform various operations on MQTT PUBLISH messages like modify its contents.
NOTE: Please make sure that MQTT PUBLISH message expects to receive a payload by using MQTT::payload length. This is to make sure that the payload length is not zero before calling this command.

Syntax

MQTT::collect [bytes]

MQTT::collect

  • Collect the entire payload of the MQTT message. To stop collecting use MQTT::release command.

MQTT::collect <bytes>

  • Collect bytes of payload of the MQTT message. If paylaod is smaller than collect entire payload. The collected data can be accessed via the MQTT::payload command. To stop collecting use MQTT::release command.

Examples