I'm facing issues while connecting to my local MQTT Broker running in docker.
Here is my connection file:
import mqtt from 'mqtt';
const client = mqtt.connect({
host: 'ws://192.168.31.46',
port: 1883,
});
client.on('connect', () => {
console.log('Connected');
client.subscribe('SEND_MESSAGE', function (topic, message) {
console.log({ topic, message });
});
});
export default client;