No, nodes can only have a single input.
You can use properties of the incoming messages to distinguish different sources.
Is there a way to create a node with 2 or more inputs?
Could you describe a bit more about what you're trying to do?
It isn't just the ui that only allows a single input; the nodes only have a single 'input' event in the runtime.
This was a purposeful design choice from the start. But I'm always keen to hear of use cases for it. All of the ones we have thought of have perfectly viable alternatives using the single input scheme we already have.
I'm still really new and wrapping my head around how much of Node-Red works. Please forgive my ignorance. It looks like a really awesome system and I absolutely love the UI for connecting stuff.
And don't forget node.js is asynchronous in nature so each input would very in their own time. So you have to maintain state of all the other inputs. And then send an output based on the change of which input ? First ? Last? All ? Should initial output not occur until a valid input has been received on all inputs or should they default to some value ? Lots of potential behaviours that may need to be handled or exposed.
You can always have 5 outputs.... 1 for each separate and one for the JSON... Best of both...
Indeed - awesome. +1
I'm happy to have the discussion.
A single input was an early design decision based on the simple fact that everything we were doing only needed a single input. We've tried to stick with that approach and we haven't hit a scenario that can't be solved with a single input.
I would be interested to see what specific scenarios you think are better served by multiple inputs. I think it is subjective which approach is more intuitive to users; we have a broad user base. But if we can identify such use cases it gives us something concrete to revolve the discussion around.
Hi everyone, here's a more practical example. I've performed my desired function using the existing single-input scheme. The result is the necessity of two additional nodes that could preferably not be included:
1. "Add Topic "push""
2. "Add Topic "shift""
What I'm doing here is making a multiple input scheme on top of the existing scheme. It's clunky looking and I'm adding additional nodes to format the input of my Queue node.
Not sure how well that sits with the principle that nodes should not have to know what nodes they are wired to. And, as you say, if you have two function nodes (or Change nodes, which are a much more efficient way to set a property on the message) then it wouldn't help at all.
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/Q0YLQYCUJ_E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.