# How do I send several simple messages in one function node?

**URL:** <https://discourse.nodered.org/t/how-do-i-send-several-simple-messages-in-one-function-node/29385>\
**Category:** General\
**Created:** [2 July 2020 14:46 UTC](https://discourse.nodered.org/t/how-do-i-send-several-simple-messages-in-one-function-node/29385 "2020-07-02T14:46:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mastiff](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Mastiff](https://discourse.nodered.org/u/Mastiff)\
**Post date:** [2 July 2020 14:46 UTC](https://discourse.nodered.org/t/how-do-i-send-several-simple-messages-in-one-function-node/29385/1 "2020-07-02T14:46:06Z")

</div>

I want to have different nodes to run different groups of RollerTrols with the RFXtrx. I am looking for something like this:

```auto
var msg1 = { topic: "BLINDS_T0/0x3939/4", payload:"Open" };
var msg2 = { topic: "BLINDS_T0/0x3939/5", payload:"Open" };
var msg3 = { topic: "BLINDS_T0/0x3939/6", payload:"Open" };
var msg4 = { topic: "BLINDS_T0/0x3939/7", payload:"Open" };
var msg5 = { topic: "BLINDS_T0/0x3939/8", payload:"Open" };
var msg6 = { topic: "BLINDS_T0/0x3939/9", payload:"Open" };
return [msg1, msg2, msg3, msg4, msg5, msg6];

```

This of does not work, it only sends the first message. The problem is that in the multiple messages section of the documentation it can't find out how to send different messages with different topics, only mesages with different payloads, so I don't see what my fault is. Can somebody please help me out?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [2 July 2020 14:54 UTC](https://discourse.nodered.org/t/how-do-i-send-several-simple-messages-in-one-function-node/29385/2 "2020-07-02T14:54:36Z")

</div>

Hi @Mastiff

when you return an array of messages like that, the Function node will pass the first message to the first output, the second message to the second output, and so on.

If you want the node to send all of those messages from the first output, you need to do:

```auto
return [[ msg1, msg2, msg3, msg4, msg5, msg6] ];

```

---

<div class="post-metadata">

**Author:** ![Mastiff](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Mastiff](https://discourse.nodered.org/u/Mastiff)\
**Post date:** [2 July 2020 15:18 UTC](https://discourse.nodered.org/t/how-do-i-send-several-simple-messages-in-one-function-node/29385/3 "2020-07-02T15:18:24Z")

</div>

Thank you very much! 🙂 Works perfectly!

---

<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:** [16 July 2020 15:18 UTC](https://discourse.nodered.org/t/how-do-i-send-several-simple-messages-in-one-function-node/29385/4 "2020-07-16T15:18:35Z")

</div>

Closed on 16 July 2020 15:18 UTC

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