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

Subsequent Subscribe and Publish in CloudMQTT #16

Open
atulpriyadarshi21992 opened this issue Aug 2, 2017 · 1 comment
Open

Subsequent Subscribe and Publish in CloudMQTT #16

atulpriyadarshi21992 opened this issue Aug 2, 2017 · 1 comment

Comments

@atulpriyadarshi21992
Copy link

Hi,I was trying to subscribe for messages from CloudMQTT server and do some BLE operation and send the result back using Publish command. But I am facing some issues when I try to publish the data.
The error is surfacing some of the time. It seems like the publish command is interfering with MQTTYield command as well. As I get some SSL error 0x7780 sometimes during the publish.

Also sometimes the Yield returns -1(FAILURE) during publish command.

My theory is that the Yield code is considering the Publish acknowledgment as the PING acknowledgement from previous yield command. I tried making the Publish command from another task but the same issue is prevalent. Can anyone help regarding this?

@atulpriyadarshi21992
Copy link
Author

I did a bit more digging.

It turns out that I was using QOS2 as the quality of service for the publish. So it was waiting for all the acknowledgments for that publish command, thus, as a result, the Yield command couldn't be executed thus causing a failure in yield.

I added a ESP_LOG command at everytime keep alive was being called and I got the problem. I am using QOS0 and the problem is not there anymore.

There must be a better way to do that. Please suggest

Here is my Client config

data.clientID = clientId;
data.willFlag = 0;
data.MQTTVersion = 4; // 3 = 3.1 4 = 3.1.1
data.keepAliveInterval = 5;
data.cleansession = 1;
data.username = username;
data.password = password;

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