Hi Nick,
hi Node-RED-Developers,
maybe you could help me and share with me some backgrounds of Node-RED. My question is: How is the interaction between the Node-RED-Editor and the Node-RED-Runtime?
As I understood right:
1. In the graphical Node-RED-Editor a program configuration is composed, which is passed to the Node-RED-Runtime in the form of an array of Json objects.
[
{
"id": "926a347b.eed998",
"type": "inject",
"z": "dee51ddf.5dbb2",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 140,
"wires": [
[
"f9e9096a.d22448"
]
]
},
{
"id": "f9e9096a.d22448",
"type": "debug",
"z": "dee51ddf.5dbb2",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 350,
"y": 140,
"wires": []
}
]
2. The runtime goes through the array step by step and registers the corresponding Javascript modules with the appropriate configuration.
module.exports = function(RED) {
function LowerCaseNode(config) {
RED.nodes.createNode(this,config);
var node = this;
node.on('input', function(msg) {
msg.payload = msg.payload.toLowerCase();
node.send(msg);
});
}
RED.nodes.registerType("lower-case",LowerCaseNode);
}
3. And then the JSON-parameter "wires" will be used to route the messages.
Where can I find step 2 (the registration) and step 3 (the message-routing) within the node-red core on github?
I think the API for step 2 (the registration) is the following:
https://nodered.org/docs/api/modules/v/1.3/@node-red_registry.html
Best regards from Germany
Andreas