Question about combining dns + websocket protocol

I have built a BLE peripheral in C. The peripheral i made acts as Bluetooth keyboard, and also exposes a Mongoose websocket server on port 8000.

I can successfully send commands to the Mongoose websocket server which are correctly relayed via Bluetooth. So the groundwork is done.

Now i want to be able to transfer my code to ALSO run on a piece of hardware (ESP32 for example) that gets their IP via DHCP, i need somehow to expose the IP of the websocket server, and i was thinking about mDNS/zeroconf.
This made me think to implement the captive DNS sample code.

Questions:

  1. Can i use 1 manager, and just create an additional ‘DNS’ connection and for that connection set “mg_set_protocol_dns” ? Would this work, or can this cause issues with services that are already running (on the Pi for example)
  2. How can i have mongoose listen to “somename.local” address?
  3. Can this also be ‘threaded’ so that i can use the main thread for the bluetooth related callbacks and have (all) mongoose related communication running in a separate thread?

Thanx!

Hi.

Maybe a stupid question, but have you tried https://github.com/mongoose-os-libs/dns-sd?

1 Like

Sounds like @Webunity does not use Mongoose OS. But rather a plain mongoose library which is a networking core of Mongoose OS.

Said that, looking at dns-sd library as @Martin_Zdila suggested, makes sense.