I have a piece of Nats code which i can run in terminal following by node command but the same can i run in ionic2?
I need to run that nats code in IONIC2 after the click of button
Nats code:
submitBtn() {
var natnc = nc.connect({'url':'localhost:4222/';})
var subject = "test.sub";
var msg = "Hello World!";
for(var i = 0;i < 100; i++) {
natnc.publish(subject, msg);
console.log('Published [' + subject + '] : "' + msg + '"');
}
}