Dear All,
I use umqtt on ESP8266 to connect to Thingsboard MQTT broker.
AFAIK the in current implementation of umqtt, after subscribing to a topic the server must send a response, therefore the client waits for that response. However the Thingsboard built-in MQTT broker does not send any response after subscribe, so my program waits forever.
Could you please recommend any workaround? How should I rewrite the umqtt.simple to handle this behavior?
Thanks in advance
umqtt subscribe needs broker response
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: umqtt subscribe needs broker response
I would complain to the authors of the broker because it is not standards-compliant. See para 3.8.4 of the MQTT spec. If the broker has this elementary fault, how much else will turn out to be wrong with it?
If you're determined to use this broken broker I guess you could eliminate this while loop but I fear you'll be chasing a lot more bugs.
If you're determined to use this broken broker I guess you could eliminate this while loop but I fear you'll be chasing a lot more bugs.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: umqtt subscribe needs broker response
Thank you pythoncoder!
The removal of wait loop helped to solve the actual issue, however - as you predicted - some other problems raised .
So finally I had to install a "standard" mosquitto broker (tb-gateway in Thingsboard terminology) in addition to the built-in broker to have a fully compatible solution.
I wanted to avoid that, because the topic/key translation is not working out of the box and there are other difficulties as well, but it was worth the effort, now I have everything as normal MQTT service.
Thanks again for your help.
The removal of wait loop helped to solve the actual issue, however - as you predicted - some other problems raised .
So finally I had to install a "standard" mosquitto broker (tb-gateway in Thingsboard terminology) in addition to the built-in broker to have a fully compatible solution.
I wanted to avoid that, because the topic/key translation is not working out of the box and there are other difficulties as well, but it was worth the effort, now I have everything as normal MQTT service.
Thanks again for your help.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: umqtt subscribe needs broker response
No problem. mosquitto is excellent in my opinion, and you can run it on minimal hardware. I have a broker running 24/7 on an ancient Raspberry Pi.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.