Page 1 of 1

umqtt subscribe needs broker response

Posted: Thu Jun 27, 2019 10:06 am
by bjames28
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

Re: umqtt subscribe needs broker response

Posted: Thu Jun 27, 2019 10:39 am
by pythoncoder
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.

Re: umqtt subscribe needs broker response

Posted: Mon Jul 01, 2019 4:30 pm
by bjames28
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.

Re: umqtt subscribe needs broker response

Posted: Mon Jul 01, 2019 4:37 pm
by pythoncoder
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.