- My goal is: send MQTT message from non-main thread
- My actions are: trying to call
MG_ENABLE_BROADCAST: 1set under
- The result I see is:
undefined reference to 'mg_broadcast'when building with
mos build --local --platform esp32
- My expectation & question is: is it possible build with
mg_broadcast()available? Is there other way to safely send MQTT message from worker thread?
I’m guessing this is the reason: https://github.com/cesanta/mongoose/issues/1085#issuecomment-750481124
The reason is that the
mongoose library is closed source and available only in binary form.
As I see linked example uses pipes with
mg_mgr_wakeup() which is not available in mongoose version 6.18 used by Mongoose OS. Is there other way to wake mongoose thread to safely send data from other thread? Maybe I can rebuild mongoose library? The library looks open source: https://github.com/cesanta/mongoose/.
For now I just used 200 ms timer + thread safe queue but it’s just workaround rather than good solution.