# Not sending an msg.payload in function node

**URL:** <https://discourse.nodered.org/t/not-sending-an-msg-payload-in-function-node/62266>\
**Category:** General\
**Created:** [6 May 2022 06:42 UTC](https://discourse.nodered.org/t/not-sending-an-msg-payload-in-function-node/62266 "2022-05-06T06:42:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Milanovic](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Milanovic](https://discourse.nodered.org/u/Milanovic)\
**Post date:** [6 May 2022 06:42 UTC](https://discourse.nodered.org/t/not-sending-an-msg-payload-in-function-node/62266/1 "2022-05-06T06:42:12Z")

</div>

I would know if it's possible to send each 90 pulses a msg.payload. So the other 89 pulses no msg.payload to the next node  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/c/8cb185a92388dbf64700ad1ddb2b205373fc1fa4.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [6 May 2022 06:45 UTC](https://discourse.nodered.org/t/not-sending-an-msg-payload-in-function-node/62266/2 "2022-05-06T06:45:05Z")

</div>

Yes look at the doc's  
[https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously](https://nodered.org/docs/user-guide/writing-functions#sending-messages-asynchronously)

---

<div class="post-metadata">

**Author:** ![Milanovic](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Milanovic](https://discourse.nodered.org/u/Milanovic)\
**Post date:** [6 May 2022 07:13 UTC](https://discourse.nodered.org/t/not-sending-an-msg-payload-in-function-node/62266/3 "2022-05-06T07:13:18Z")

</div>

I don't understand how it works

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 May 2022 07:29 UTC](https://discourse.nodered.org/t/not-sending-an-msg-payload-in-function-node/62266/4 "2022-05-06T07:29:21Z")

</div>

A message is sent from a function ONLY when `return msg` is reached OR `node.send(msg)` is called.

Therefore, if you move `return msg` to inside your `if( I >= 90 ) { ... }` block, that will make sending messages conditional.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 July 2022 07:29 UTC](https://discourse.nodered.org/t/not-sending-an-msg-payload-in-function-node/62266/5 "2022-07-05T07:29:53Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
