# Delay inside function node between messages?

**URL:** <https://discourse.nodered.org/t/delay-inside-function-node-between-messages/3736>\
**Category:** General\
**Created:** [6 October 2018 13:22 UTC](https://discourse.nodered.org/t/delay-inside-function-node-between-messages/3736 "2018-10-06T13:22:27Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [6 October 2018 18:19 UTC](https://discourse.nodered.org/t/delay-inside-function-node-between-messages/3736/5 "2018-10-06T18:19:46Z")

</div>

This should do what you want, using just the `delay` node.

```auto
[{"id":"55680c13.4953a4","type":"debug","z":"7920414b.cfa4f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":650,"y":120,"wires":[]},{"id":"85c8db46.a1272","type":"function","z":"7920414b.cfa4f8","name":"","func":"// msg.delay is in milliseconds\nvar msg1 = { payload:\"first out of output 1\", delay:10000 };\n// if msg.delay is undefined, the delay node uses default\nvar msg2 = { payload:\"second out of output 1\" };\nvar msg3 = { payload:\"third out of output 1\", delay:0};\nvar msg4 = { payload:\"only message from output 2\"};\nreturn [[ msg1, msg2, msg3], msg4 ];","outputs":2,"noerr":0,"x":370,"y":160,"wires":[["c600d120.54da78"],["88475b70.b765b"]]},{"id":"3b9f76b1.35359a","type":"inject","z":"7920414b.cfa4f8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":160,"wires":[["85c8db46.a1272"]]},{"id":"c600d120.54da78","type":"delay","z":"7920414b.cfa4f8","name":"","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":520,"y":120,"wires":[["55680c13.4953a4"]]},{"id":"88475b70.b765b","type":"debug","z":"7920414b.cfa4f8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":510,"y":200,"wires":[]}]

```

---

_[View the full topic](https://discourse.nodered.org/t/delay-inside-function-node-between-messages/3736)._
