I want to send asynchronous data to the node on configuration. I want to perform a SQL request to list some data in a .
- On node creation, a server side function is performed
- When it's done, a callback send data to the node configuration
- On node configuration, when data is received, the list is created
Alternatively, the binary can request database each x minutes and create a cache that each node will use on creation, this will remove the asynchronous part of code, even if it's no longer "live updated".
In fact, i'm stuck because i created the query and added it as below :
module.exports = function(RED) {
"use strict";
var db = require("../bin/database")(RED);
function testNode(n) {
// Create a RED node
RED.nodes.createNode(this,n);
// Store local copies of the node configuration (as defined in the
.html
var node = this;
var context = this.context();
this.on('input', function (msg) {
node.send({payload: true});
});
}
RED.nodes.registerType("SQLTEST",testNode);
}
But I don't know how to pass data to the configuration node. I thought of Socket.IO to do it, but, is this a good idea and is it available? Do you know any solution ?