I configured HiveMQ server and installed the MQTT npm package in the node js. I published the message to the HiveMQ server from different system in the same network.I want to subscribe the message asynchronously. How to achieve this? Code Snippet :
Published from different system to the HiveMQ
client.on('connect', function(){
client.publish('Test', 'test Message');
});
Want to subscribe from HiveMq asynchronously
client.on('connect', function(){
client.subscribe('Test');
});
client.on('message', function(topic, message){
});