HI All,
I am using HIVE MQ Enterprise edition trial version. I have a publisher client which publishes message on receiving message from a separate client . Basically there is one client subscribing to a topic, when message is received it verifies it and then the second client publishes the message again to a different topic.
My client connection file looks something like this :
var mqtt = require('mqtt');
var options = {
port: process.env.MQTT_PORT, // Required
host: process.env.MQTT_HOST, // Required
clientId: 'mqttjs_abhar_' + Math.random().toString(16).substr(2, 8), // Randomly generated ID
username: process.env.MQTT_USERNAME, // Required
password: process.env.MQTT_PASSWORD, // Required
protocol: process.env.MQTT_PROTOCOL, // Required
connectTimeout:1000,
keepalive: 60,
};
var client = mqtt.connect(process.env.MQTT_HOST, options);
client.on('connect', function() { // When connected
console.log('MQTT BROKER connected');
});
module.exports=client;
The options I am using to publish messages are :
var options={
retain:false,
qos:1};
If I restart the whole thing it starts working properly but after sometime of being idle the messages are received by the subscriber client but not sent using the publisher client.
Thanks in advance