esdee/discoverer
Provides an actor-based DNS-SD discovery mechanism.
Types
A handle to a service discovery actor.
pub opaque type Discoverer
Values
pub fn poll_service_details(
discoverer: Discoverer,
service_type: String,
) -> Result(Nil, toss.Error)
Sends a DNS-SD question querying the given service type in the local network. If there are errors with the socket(s), returns the first error.
pub fn poll_service_types(
discoverer: Discoverer,
) -> Result(Nil, toss.Error)
Sends a DNS-SD question querying all the available service types in the local network. If there are errors with the socket(s), returns the first error.
pub fn start(
options: esdee.Options,
) -> Result(actor.Started(Discoverer), actor.StartError)
Starts a DNS-SD service discovery actor with the default timeouts.
pub fn start_with_timeouts(
options: esdee.Options,
start_timeout_milliseconds: Int,
poll_timeout_milliseconds: Int,
) -> Result(actor.Started(Discoverer), actor.StartError)
Starts a DNS-SD service discovery actor with custom timeouts. The timeouts apply to the actor startup, and it responding to poll requests respectively. Both should be very fast, as no incoming data is waited for.
pub fn subscribe_to_service_details(
discoverer: Discoverer,
service_type: String,
subject: process.Subject(esdee.ServiceDescription),
) -> Nil
Subscribes the given subject to all discovered service details.
You will also need to call poll_service_details to discover services quickly.
pub fn subscribe_to_service_types(
discoverer: Discoverer,
subject: process.Subject(String),
) -> Nil
Subscribes the given subject to all discovered service types.
Note that the same service type might be reported by multiple peers.
You will also need to call poll_service_types to discover services quickly.
pub fn supervised(
options: esdee.Options,
start_timeout_milliseconds: Int,
poll_timeout_milliseconds: Int,
) -> supervision.ChildSpecification(Discoverer)
Returns a child specification for running the actor with supervision.
pub fn unsubscribe_from_service_details(
discoverer: Discoverer,
service_type: String,
subject: process.Subject(esdee.ServiceDescription),
) -> Nil
Unsubscribes the given subject from receiving details for the given service type.
pub fn unsubscribe_from_service_types(
discoverer: Discoverer,
subject: process.Subject(String),
) -> Nil
Unsubscribes the given subject from discovered service types.