PUBLISH & SUBSCRIBE in the same program

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
masoldier
Posts: 4
Joined: Wed Aug 30, 2017 8:59 am

PUBLISH & SUBSCRIBE in the same program

Post by masoldier » Tue Jun 05, 2018 6:22 am

Hey community, hope everyone is creating something awesome with our beloved MicroPython+NodeMCU :D

Let's cut to the chase - I am successfully able to PUBLISH and SUBSCRIBE to messages on Adafruit and it just works. The real problem is that when I try to merge these two-independent programs into one, everything gets destroyed.

1. The broker gets stuck and just sits there like a fossil.
2. Hardly ever my NodeMCU publishes or responds to a subscribed message and that too in multiple resets of the board.

Please help me out here. I am in PAIN :!:

kevinkk525
Posts: 183
Joined: Sat Feb 03, 2018 7:02 pm

Re: PUBLISH & SUBSCRIBE in the same program

Post by kevinkk525 » Tue Jun 05, 2018 8:51 am

Maybe you can tell us a little more about your broker and your client program

User avatar
Mike Teachman
Posts: 26
Joined: Mon Jun 13, 2016 3:19 pm
Location: Victoria, BC, Canada

Re: PUBLISH & SUBSCRIBE in the same program

Post by Mike Teachman » Fri Jun 08, 2018 4:10 am

coincidentally, I just updated my github MQTT examples to support the lastest MicroPython and CircuitPython releases. I included an example on using Publish and Subscribe in the same file. Check out the file pubAndSub.py. It might have what you are looking for.

https://github.com/MikeTeachman/micropy ... tt-esp8266

Post Reply