- My goal is: send MQTT message from non-main thread
- My actions are: trying to call
mg_broadcast()withMG_ENABLE_BROADCAST: 1set undercdefssection inmos.yml - The result I see is:
undefined reference to 'mg_broadcast'when building withmos 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.
The Mongoose OS mongoose library is here. It is a wrapper of the mongoose embedded network library.
Because of different licensing, the Mongoose OS mongoose library is closed source and that’s why it is distributed in binary form only.