umqtt subscribe needs broker response

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
bjames28
Posts: 4
Joined: Fri May 17, 2019 12:55 pm

umqtt subscribe needs broker response

Post by bjames28 » Thu Jun 27, 2019 10:06 am

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

User avatar
pythoncoder
Posts: 3718
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: umqtt subscribe needs broker response

Post by pythoncoder » Thu Jun 27, 2019 10:39 am

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.
Peter Hinch

bjames28
Posts: 4
Joined: Fri May 17, 2019 12:55 pm

Re: umqtt subscribe needs broker response

Post by bjames28 » Mon Jul 01, 2019 4:30 pm

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.

User avatar
pythoncoder
Posts: 3718
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: umqtt subscribe needs broker response

Post by pythoncoder » Mon Jul 01, 2019 4:37 pm

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

Post Reply