1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
node-red/packages/node_modules/@node-red/nodes/examples/function/function/02 - Send multiple messages.json
2020-06-24 14:43:27 +01:00

1 line
1.5 KiB
JSON

[{"id":"c2b3b0f1.62189","type":"inject","z":"b4c03214.fa42e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":100,"wires":[["7241db1e.8946c4"]]},{"id":"c6191361.0f3c","type":"debug","z":"b4c03214.fa42e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":80,"wires":[]},{"id":"3aa5727c.e5019e","type":"comment","z":"b4c03214.fa42e","name":"send multiple message","info":"Function node can send multiple messages to output ports by returning an array of messages. \n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":140,"y":40,"wires":[]},{"id":"7241db1e.8946c4","type":"function","z":"b4c03214.fa42e","name":"return array of messages","func":"// returning array of message send elements to output ports\nvar msg1 = { payload:\"first out of output 1\" };\nvar msg2 = { payload:\"second out of output 1\" };\nvar msg3 = { payload:\"third out of output 1\" };\nvar msg4 = { payload:\"only message from output 2\" };\nreturn [ [ msg1, msg2, msg3 ], msg4 ];","outputs":2,"noerr":0,"initialize":"","finalize":"","x":370,"y":100,"wires":[["c6191361.0f3c"],["23a53d00.c89b74"]]},{"id":"23a53d00.c89b74","type":"debug","z":"b4c03214.fa42e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":120,"wires":[]}]