Node to Subflow Linking

Hello, I've done a node to try to get subflow linking, the idea is to be used inside subflows to give like a subflow to cast messages or to get inputs into subflows from other subflows.

The ideia is to be as light as possible, and to have as little impact as possible in the system! Since all new node creates a new instance, the broadcast of the messages is handled by the config node, and basically each config is a new link.

The user can opt by cloning a message, and this can be selected in the config (clone all messages of the link) or in the output (only clone messages in that output). The idea is to only clone outputs when needed, to avoid cross node changes to the message.

Normally I don't like to reference people in posts, but I think @knolleary feedback could be very useful in this situation, since this is something that never was added to nodered core.

The Nodes
image

The Input Node Parameters
image

The Output Node Parameters
image

The Config Node Parameters
image

All the nodes are linked by the config node

Some feedback and ideas are welcome

1 Like

The basic idea of Node-RED is that messages flow along wires and are visible so that it is easy to trace the flow. These nodes create invisible paths so are not in that spirit, so unlikely to be part of the core.

Hello, thank you for the replay, I don't mean it to be part of the core, but I would like some expert opinion on the idea of solution, and code. Something like this, I think, it's very useful and can power the subflows to another type of use cases! I know that I always looked ate solutions to this lack of functionality, and now decided to try to make a node to help in this!

1 Like

How do they differ from the built-in link nodes?

If you have one of you inputs inside a subflow, and you have 100 instances of the subflow in your flows do they all get the messages sent to the input?

Yes they do! If they are linked by the same link, one inlupt will trigger messages inside all the subflows that have that link!

I did this to try to have as little impact as possible in the memory! This are my teste

I have a normal link that is casting a 1920x1080 image content to 30 link nodes (extreme case)
image

This is the memory consumprion and the garbage collector process.

And I did the same thing to my node inside a subflow

And this is the results

I allways restart nodered in each test and this is a clean install

I noticed now that you where asking about inputs... The input node is just like a normal link input node, but I can set it inside a subflow and link it to a output node in a different subflow... or add a input in the main flow and a output in subflow...

If a input casts a message to a output that is inside a subflow, all instances of that subflow will recive that message.

In the other hand, if a input is inside a subflow, all messages that enter all instances of that subflow will cast a message that will arrive in all output nodes that are linked.

Notice that you can have multiple outputs to one input, but each will only be linked by a link... Making that to one output node only can receive messages from one input link (this I can change, but for now the link is 1:n, you can't have one output receiving messages from more that one input)

I made a test, to chek if my link node wasn't making some delays, and the results are again good, I used the same test method, a input node casting to 30 output nodes a 1920x1080 image. Then a mesured the time before the input and after the output. This are the results

Core Link Nodes

My Sub Link inside Subflow

The Node in The subflow is a bit more slow, but I don't think it's that relevant. The delay might be related with the config node that it's used as a router, but the main idea is to use the config node to manage the links, to avoid having each instance of subflows create new objects with routing data

Just to close this topic with the information that the node is live:

Thank you

1 Like

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