Page 1 of 1

it is impossible to subscribe in the aws_iot/subscribe_publish example..

Posted: Sun Dec 31, 2017 4:09 pm
by JoonDong
publish works well, but subscribe does not work.

aws_iot_mqtt_subscribe(&client, SUB_TOPIC, SUB_TOPIC_LEN, QOS0, iot_subscribe_callback_handler, NULL) returns SUCCESS, but iot_subscribe_callback_handler callback function is not called when I publish to topic "1" in the aws iot console.

Of course, I set SUB_TOPIC to "1" and remainders(CA, policy, attach and so on..) appropriately.

Ia not AWS Iot subscribe implemented yet?

Re: it is impossible to subscribe in the aws_iot/subscribe_publish example..

Posted: Tue Jan 02, 2018 12:16 am
by ESP_Angus
Hi JoonDong,

Subscribe is supported. The example works for me (unmodified) on the current master branch. ie if I log into AWS IoT Console and subscribe to "test_topic/esp32" then I see the "hello from ESP32" messages published from the ESP32, and if I then click the "Publish to Topic" button in the console then I see that message in the ESP32 console.

Image

Code: Select all

I (217435) subpub: test_topic/esp32	hello from ESP32 (QOS0) : 164 
I (217625) subpub: Subscribe callback
I (217625) subpub: test_topic/esp32	{
  "message": "Hello from AWS IoT console"
}
I (218105) subpub: Subscribe callback
I (218105) subpub: test_topic/esp32	hello from ESP32 (QOS1) : 165 
I (218195) subpub: -->sleep
I (219855) subpub: Subscribe callback
I (219855) subpub: test_topic/esp32	hello from ESP32 (QOS0) : 166 
It looks like you're running different code to the example, though. If you're still have problems, please post your full code and we can take a look.

Angus