aws-mqtt icon indicating copy to clipboard operation
aws-mqtt copied to clipboard

Upon connecting, cannot subscribe without setting client.connected = true

Open damoncasale opened this issue 4 years ago • 0 comments

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.

damoncasale avatar Jul 15 '20 07:07 damoncasale