Espex.Mdns.MdnsLite (espex v0.1.1)

Copy Markdown View Source

Default Espex.Mdns adapter backed by the :mdns_lite library — the mDNS responder shipped with Nerves.

Espex does not declare :mdns_lite as a runtime dependency; this module uses late-binding (Code.ensure_loaded?/1 + apply/3) so the espex library compiles and loads on systems that don't have it. If a consumer wires this adapter without pulling :mdns_lite into their own deps, c:advertise/1 returns {:error, :mdns_lite_not_loaded} instead of crashing with UndefinedFunctionError.

Usage

Add :mdns_lite to your own application's deps:

# mix.exs
{:mdns_lite, "~> 0.8"}

then wire the adapter:

Espex.start_link(
  device_config: [name: "my-device", ...],
  mdns: Espex.Mdns.MdnsLite
)