yell/discoverer

An OTP Actor that sends SSDP discovery requests to find services on the network. Normally this actor is not used directly but as a supervised child of the yell/monitor actor.

Types

A configuration builder for discovery requests. Create with new() and configure with max_wait() and with_header().

pub opaque type Builder

A running discoverer actor that can receive messages

pub opaque type Sender

Values

pub fn loop(actor: actor.Started(Sender), interval: Int) -> Nil

Instruct actor to send SSDP discovery messages at a fixed interval (in ms)

pub fn max_wait(builder: Builder, delay: Int) -> Builder

Configure the maximum time (in seconds) receivers should wait before sending a reply. Clamped to between 1 and 5 seconds, default 1 second.

pub fn new(search_target: String) -> Builder

Create a builder for the discovery actor

  • search_target - What to search for (e.g., “ssdp:all”, “upnp:rootdevice”, or a specific service type)
pub fn send(actor: actor.Started(Sender)) -> Nil

Instruct actor to send a single discovery message.

pub fn start(
  builder: Builder,
) -> Result(actor.Started(Sender), actor.StartError)

Start the discoverer actor. This will open a multicast UDP socket but will not send any messages until instructed to do so with send or loop.

pub fn stop(actor: actor.Started(Sender)) -> Nil

Instruct actor to stop sending SSDP discovery messages

pub fn subscribe(
  builder: Builder,
  with subscriber: process.Subject(yell.Message),
) -> Builder

Subscribe a subject to receive messages from this listener. Multiple subjects can be subscribed.

pub fn supervised(
  builder: Builder,
  interval: Int,
) -> supervision.ChildSpecification(Sender)

Builds a worker child specification for the actor to send discovery requests every interval ms.

pub fn with_header(
  builder: Builder,
  key: String,
  value: String,
) -> Builder

Add a custom HTTP header to discovery messages.

Search Document