Search code examples
javascriptmqttnode-red

Returning multiple messages in node-red function


I'm parsing a json object in a node-red function. The results are between 0 and 30 msg.payloads, which are returned as an array from the function. These messages are send to a mqtt node for further processing. It seems that the mqtt node (or the broker) are overwhelmed by 30 payloads in one shot, since not all values are coming through.

Is there a way to delay sending multiple payloads, i.e.

send payload 1

wait 1s

send payload 2

wait 1s

etc

Many thanks in advance.


Solution

  • You can use the Delay node in the core palette to rate-limit messages between the Function node and the MQTT node - just be sure not to tick the 'drop intermediate messages' option.