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

Multiple unsubscribe or publish with QoS 1 in callback #80

Open
jreber2 opened this issue Apr 12, 2017 · 1 comment
Open

Multiple unsubscribe or publish with QoS 1 in callback #80

jreber2 opened this issue Apr 12, 2017 · 1 comment

Comments

@jreber2
Copy link

jreber2 commented Apr 12, 2017

A ESP8266 client is subscribed to 9 topics (all retained messages). In callback are 9 if statements that are handling the received messages. After connection is established and callback function is set, ESP get stuck in callback function (and newer gets out) under certain conditions:
Case 1:
If statement for the first four or more topics: when a message on a topic is received, the client unsubscribes from the topic.
Case 2:
If statement for the last seven or more topics: when a message on a topic is received, the client unsubscribes from the topic.
Case 3:
If statement for the first four or more topics: when a message on a topic is received, the client publishes a message to another topic with QoS 1 (works with QoS 0).
Case 4:
If statement for the last seven or more topics: when a message on a topic is received, the client publishes a message to another topic with QoS 1 (works with QoS 0).

It’s a bit complicated but I hope you can get the point.

Unsubscribe is done as follows:
MQTTclient.unsubscribe(MQTT::Unsubscribe().add_topic(pub.topic()));

And publish:
MQTTclient.publish(MQTT::Publish(topic, payload) //(String topic, String payload)
.set_retain() // Set retain flag
.set_qos(qos) // (0-2) Set QoS value
);

Could you help me with the issue?

@amrithmmh
Copy link

can you please share your complete callback function code?

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

2 participants