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_cxx - Client::on_subscribed has empty topic (IDFGH-11063) #356

Closed
3 tasks done
tajnymag opened this issue Sep 13, 2023 · 2 comments
Closed
3 tasks done

mqtt_cxx - Client::on_subscribed has empty topic (IDFGH-11063) #356

tajnymag opened this issue Sep 13, 2023 · 2 comments
Assignees

Comments

@tajnymag
Copy link

tajnymag commented Sep 13, 2023

Answers checklist.

  • I have read the documentation for esp-protocols components and the issue is not addressed there.
  • I have updated my esp-protocols branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

While using esp_mqtt(_cxx) component, I was surprised by lines of Subscribed to in the monitor.

idf::mqtt:Client has a hardcoded printf call in its on_subcribed method. This method, however, seems to get an empty string for its given event->topic.

In Client::on_data, event has topic loaded properly and I can print it just fine with the exact same printf statement.

Example monitor output (first "Subscribed to" comes from on_subscribed, second from on_data):

I (10951) mqtt_client_cpp: MQTT_EVENT_CONNECTED
I (10961) mqtt_client_cpp: MQTT_EVENT_SUBSCRIBED, msg_id=34865
Subscribed to
I (10961) mqtt_client_cpp: MQTT_EVENT_DATA
Subscribed to $SYS/broker/messages/received
I (10961) Main: Received in the $SYS/broker/messages/received topic
@github-actions github-actions bot changed the title mqtt_cxx - Client::on_subscribed has empty topic mqtt_cxx - Client::on_subscribed has empty topic (IDFGH-11063) Sep 13, 2023
euripedesrocha added a commit to euripedesrocha/esp-protocols that referenced this issue Sep 19, 2023
Removes the printf since the information isn't in the event.

Closes espressif#356
euripedesrocha added a commit to euripedesrocha/esp-protocols that referenced this issue Sep 19, 2023
Removes the printf since the information isn't in the event.

Closes espressif#356
@euripedesrocha
Copy link
Collaborator

euripedesrocha commented Sep 19, 2023

Hi @tajnymag, thanks for reporting.
That printf is meaningless since the event dispatched from the mqtt client doesn't have the information. I created #358 to remove it.

You can check about the events in IDF documentation

Regarding the information in the DATA event, this is part of your code? I searched in the examples and we don't have this.

euripedesrocha added a commit to euripedesrocha/esp-protocols that referenced this issue Sep 19, 2023
Removes the printf since the information isn't in the event.

Closes espressif#356
@tajnymag
Copy link
Author

tajnymag commented Sep 19, 2023

Hi @tajnymag thanks for reporting.
That printf is meaningless since the event dispatched from the mqtt client doesn't have the information. I created #358 to remove it.

You can check about the events in IDF documentation

Regarding the information in the DATA event, this is part of your code? I Searched in trhe examples and we don't have this.

Thank you for removing the line.

No, it's part of idf::mqtt::Client (esp_mqtt_cxx). I had played with this example where an override for on_data is used to check received topic.

euripedesrocha added a commit to euripedesrocha/esp-protocols that referenced this issue Oct 25, 2023
0.2.0
Features
- configure client authentication via certificate/key or secure element (ee09ff4)
Bug Fixes
- removed Wno-format flag and fixed formatting warnings (c48e442)
- Removes meaningless printf on subscribed handler (espressif#358) (bac742d, espressif#356)
- Removes unused type for configuration (839c79d)
- added idf_component.yml for examples (d273e10)
- Reintroduce missing CHANGELOGs (200cbb3, espressif#235)
Updated
- docs(common): updated component and example links (f48d9b2)
- docs(esp_mqtt_cxx): updated documentation and deployment file (a547ec8)
- docs(common): improving documentation (ca3fce0)
- Add homepage URL and License to all components (ef3f0ee)
igrr pushed a commit to igrr/esp-protocols that referenced this issue Nov 7, 2023
…essif#358)

Removes the printf since the information isn't in the event.

Closes espressif#356
CommanderRedYT pushed a commit to CommanderRedYT/esp-protocols that referenced this issue Mar 18, 2024
…essif#358)

Removes the printf since the information isn't in the event.

Closes espressif#356
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

3 participants