aws-mqtt
aws-mqtt copied to clipboard
Upon connecting, cannot subscribe without setting client.connected = true
After doing extensive testing and debugging, I found that client.connected is set to false after connecting, and that subscriptions simply fail silently -- without even calling the callback -- if client.connected is false.
I had to force it to true, before subscriptions worked as expected.
client.on('connect', (ack) => {
console.log("Connected to MQTT", ack);
// I shouldn't have to manually set connected to true!!!
client.connected = true;
client.subscribe("/ATopic", {}, (err, granted) => {
...
});
...
});
This took me nearly three hours of wasted time to debug. FIX THIS PLEASE.