Hi,
I am creating a custom node which should be able to make a COAP request while deploying. So I need to implement that COAP request inside the javascript file of my custom node. I use "coap" npm module for this.
module.exports = function(RED) {
function myCustomNode(config) {
RED.nodes.createNode(this, config);
var coap = require('coap')
var req = coap.request('coap://localhost/hello')
req.on('response', function (res) {
res.pipe(process.stdout)
res.on('end', function () {
process.exit(0)
})
})
req.end();
RED.nodes.registerType("myCustomNode", myCustomNode);
}
Hope my understanding is correct up to this level. Please correct me if I am wrong.
My code looks like above. I checked the COAP call source code part in node.js application and it is working fine. But I am not getting the response when I deploy my custom node.
What is the reason for this?