Mg_broadcast is undefined on ESP32

  1. My goal is: send MQTT message from non-main thread
  2. My actions are: trying to call mg_broadcast() with MG_ENABLE_BROADCAST: 1 set under cdefs section in mos.yml
  3. The result I see is: undefined reference to 'mg_broadcast' when building with mos build --local --platform esp32
  4. 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.