const mqtt = require('mqtt');
const client = mqtt.connect('mqtt://IP_ADDRESS_OF_THE_BROKER', {
username: 'gladys',
password: 'my-password'
});
const TOPIC_NAME = "gladys/master/device/mqtt:sensor/feature/mqtt:temperature/state"
client.on('connect', () => {
// sending a new temperature of 12°C recorded
client.publish(TOPIC_NAME, 12);
});