Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
damoncasale opened this issue Jul 15, 2020 · 0 comments

Comments

@damoncasale
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant