I am playing around with node-red and want to learn more...
Problem i cant solve is how to create two msg(msg1 and msg2) in a function
This must be the output
//input msg for function
// test0: "test0"
//msg1
// test0: "test0"
// test1: "test0"
// msg2
// test0: "test0"
// test2: "test2"
I can create twe two msg within the function, but msg2 only contains var test and not the old input content .
test = {"test2":"test2"} // new extra var for msg2. But how do i add old msg ?
// add var to current msg
msg1.test1="test1"
msg2=test; // how do i also add content of msg1 (current msg)
return[msg1,msg2]
var msg1 = RED.util.cloneMessage(msg);
var msg2 = RED.util.cloneMessage(msg);
// now update msg1 and msg2 with whatever extra properties you want
msg1.test = "red";
msg2.test = "blue";
return [msg1,msg2]