Delay node, when send a msg.reset can I send also next parameters?

Hi, I need to reset a node delay from previous value and at the same time I need to set on it the new message with new delay value. Can I do it with the same object or should I create anpther output on that function and delay a bit the new message?

Here are the examples, everything in one message:

msg={reset:true, payload:"What I need to be delayaed", delay:50000}; return msg;

Or I need 2 outputs from the function, both goes to delay node, the first directly, the second by a fixed delay of for example 10 ms

msg1={reset:true}; msg2={payload:"What I need to be delayaed", delay:50000}; return [msg1,msg2];

Thank you

If you return and array containing an array it will send the messages one after the other to the same output so

msg1={reset:true}; 
msg2={payload:"What I need to be delayaed", delay:50000}; 
return [[msg1,msg2]];

That assumes that you tried the technique with the reset and the new message in one go and it did not work.

thank you for kind reply, I'm afraid we didn't understand each other, in the first case, the one more interesting for me, I have only one output to the delay, I would know if in the message there is the reset value, followed by the next object the delay node will reset any previous message it contains and in the same time it got the new message which I want to receive the next time. No sorry I haven't tried it yet, I'm working remotely to a delicate thing and if this solution will not work I'll use the "backup" one, which should work,
on the second output I reset the node, on the first output (delayed by x millisec to be sure it will come later, even if asyncronous messages on node will be delayed) I'll send the next message.
Just the first solution is more clean on flow and code. Thanks

Hi - The source code for the node is here - https://github.com/node-red/node-red/blob/ccc3809daa3b03e7171cb6f4ccf4d6e0f1188bef/packages/node_modules/%40node-red/nodes/core/core/89-delay.js#L133

You can see that we handle the delay value first - then if reset is set we clear out any remaining messages. So I think that is what you hoped it would do with your first example. IE. set it up ready for next time but not send it now.

Thank you a lot!
I don't know if it may mess up flows of users that are already working but I would suggest you to change the order in the next Node Red update, so first do the reset (if object contains it) and after setup the new time.
Logically there is no sense to send info to the delay node if a reset is contained, unless for future purpuses like in my case..).
In this way it should semplify a lot the flow, now I need 2 outputs on function and add a delay more.. and I've lot of these kind of nodes needs (For example every time I?m sending a command to any actuator, for safety purposes I want to send after some time (more then what is planned) a clear command. If there become any situation why the actuator still working it will be cleared. The clear command is contained in the delay node, if a new command will income I need to clear the "clearing command" to avoid a clear during normal functioning)
Thank you )

No you don't, as I showed you send two messages one after the other on the same output. There is no need for the delay as the first one sent is bound to get there first.

However, I think that @dceejay was saying that it will work with delay, reset and new message all in one message, because the reset clears waiting messages before it sets up the new one. The reset does not clear the delay timer, just the waiting messages.

Again thank you for help,
but I've not catch how to send two messages on the same output.. my fault maybe sorry, by now I just know that if I create different objects I can return them and they will go out in different outputs, according to the order, for example
msg1={something}; msg2={something}; return [msg1,msg2];
msg1 outputs from output1 and msg2 from the second one.
there are different ways? If for example I've only one output, the 2 objects will be sent on the same output one after other or the msg2 will not output?
Maybe you suggest me to put the two outputs together and be confident that the msg1 will go out before msg2?
What about the asynchronous process of managing messags on flow? can msg1 eventually come later than msg2 for any reasons regarded to it? I need to be sure..
Thank you!

As I said in an earlier post

The significant point is that it is an array within an array. It is explained in the link below.
If you send one message followed by another down the same wire there is no way the second one will overtake the first. Many many flows rely on that.
https://nodered.org/docs/writing-functions#multiple-messages

super, thank you a lot!
now I'm curious, if for example I have 3 objects but 2 outputs only, there the 3rd objects will be output?