hello firends,
this is my function:
var LastCommands = msg.payload.split('\n')
global.set("LastCommands", LastCommands);
LastCommands.forEach(function(command) {
// send each "command" with 250ms delay to MQTT node
});
How can I send a msg.payload for each iteration in the loop to an other node (MQTT) ?
Thx !
or instead - use a split node (that will emit one msg per line (\n) - then a delay node in rate limit mode set to 250mS
thx!
I made it like this:
var LastCommands = msg.payload.split('\n')
global.set("LastCommands", LastCommands);
LastCommands.forEach(function(command) {
node.send({payload:command});
});
...plus random delay node