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

MQTT_EVENT_PUBLISHED event not firing #71

Closed
mh00h opened this issue Sep 13, 2018 · 2 comments
Closed

MQTT_EVENT_PUBLISHED event not firing #71

mh00h opened this issue Sep 13, 2018 · 2 comments

Comments

@mh00h
Copy link

mh00h commented Sep 13, 2018

First found in my own program, I have identified a bug which can be reproduced using the mqtt_tcp example. This event doesn't fire:

   58         case MQTT_EVENT_PUBLISHED:
   59             ESP_LOGI(TAG, "MQTT_EVENT_PUBLISHED, msg_id=%d", event->msg_id);
   60             break;

Subscribing to relevant mqtt topic shows that data packets do flow to their correct locations; it's just the event that isn't firing.

I (4170) MQTT_SAMPLE: MQTT_EVENT_SUBSCRIBED, msg_id=63326
I (4180) MQTT_SAMPLE: sent publish successful, msg_id=0
D (4190) MQTT_CLIENT: msg_type=11, msg_id=23782
D (4190) MQTT_CLIENT: pending_id=23782, pending_msg_count = 1
D (4200) MQTT_CLIENT: UnSubscribe successful
I (4200) MQTT_SAMPLE: MQTT_EVENT_UNSUBSCRIBED, msg_id=23782
@mh00h
Copy link
Author

mh00h commented Sep 13, 2018

Perhaps related to this is another problem I'm experiencing:

//ran sequentially:
xEventGroupSetBits(controller, MQTT_PUBLISHED_BIT);
ESP_LOGI(TAG, "controller eventGroup bits: %x", xEventGroupGetBits( controller )); //to confirm bit got set
vTaskDelay(40); //this required to make race condition succeed
msg_id = esp_mqtt_client_publish(client, "/root", payload, 0, 0, 0);

race condition output options:
    E (2560) MQTT_CLIENT: Client has not connected
OR
    //mosquitto receives the message

@ghost
Copy link

ghost commented Oct 14, 2018

Hi,

Have you tied sending with QoS 1 or 2, because QoS 0 is "fire and forget" and the MQTT protocol will not confirm message reception.

Kind regards,
Oscar

@mh00h mh00h closed this as completed Oct 26, 2018
@mh00h mh00h reopened this Nov 4, 2018
@mh00h mh00h closed this as completed Nov 4, 2018
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