Help with how to create messages with `inject` node

Usually the inject node injects stuff in msg.payload.

You can edit the topic in another field.

Just because I want to optimise node usage:
Is there a way to make the inject node send a msg.flush message?

I'm guessing it uses the { } option.

In a function node, it is this:

msg = {

But I am not getting how to put that in the inject node.


No. The Inject node can only set payload and/or topic.

1 Like

On that, it is the delay node which has caught my interest.

It says if I inject a flush all messages will be flushed.
To me that means they are forgotten.

(Nic, I saw your reply come in. I'll read it after posting this)

This flow is basically what I want done.

I press the message node. It is delayed 5 seconds.

But as I see it, if I press the flush button the node should be flushed.

I still get the message.


Ah! I need to send a reset message too.

My bad.

Post left to help anyone else who may fall for that trap.

[{"id":"a705a461.d8d19","type":"delay","z":"55b8031d.59ac1c","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":540,"y":1170,"wires":[["d29665c1.ae2cc8"]]},{"id":"cadeead6.dd7c","type":"function","z":"55b8031d.59ac1c","name":"","func":"msg = {\n    'flush':'blah'\n};\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":1100,"wires":[["9d2a6c18.b30bb","a705a461.d8d19"]]},{"id":"8355c78a.e3e6a8","type":"inject","z":"55b8031d.59ac1c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":1100,"wires":[["cadeead6.dd7c"]]},{"id":"9d2a6c18.b30bb","type":"debug","z":"55b8031d.59ac1c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":550,"y":1100,"wires":[]},{"id":"2cddc0a9.e6c208","type":"inject","z":"55b8031d.59ac1c","name":"","topic":"","payload":"Message","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":1170,"wires":[["a705a461.d8d19"]]},{"id":"d29665c1.ae2cc8","type":"debug","z":"55b8031d.59ac1c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":700,"y":1170,"wires":[]}]

Reset will reset the node. I.E. forget everything (which is what you want.)
Flush will send everything stored up immediately (like unblocking/flushing a pipe)

My bad.

I tripped on that. I read it and mis-parsed it.

What I think it was is I am using some `trigger` and some `delay` nodes. In the `trigger` node `reset` clears all messages. In the `delay` node `reset` . . . . I'm confused. I'll shut up.

All working now.