yell/monitor
OTP Actor that keeps track of SSDP services and notifies subscribers when new services appear or existing services fail to check in.
Types
Messages emitted by the monitor
Alive: sent when an SSDP service sends a notificationDied: sent when an SSDP service goes offline or fails to check in
pub type Update {
Alive(usn: uri.Uri, message: listener.Message)
Died(usn: uri.Uri)
}
Constructors
-
Alive(usn: uri.Uri, message: listener.Message) -
Died(usn: uri.Uri)
Values
pub fn discovery_interval(
builder: Builder,
discovery_interval: Int,
) -> Builder
Set the interval, in ms, between discovery requests (default 30000)
pub fn grace_period(
builder: Builder,
grace_period: Int,
) -> Builder
Set the grace period, in ms, to wait after the cache entry for a service expires before concluding the service died (default 1000).
pub fn last_message(
actor: actor.Started(Monitor),
usn: uri.Uri,
) -> Result(listener.Message, Nil)
Get the last message from a service. Returns Error if the service doesn’t exist or died
pub fn new(
name: process.Name(listener.Message),
subscriber: process.Subject(Update),
) -> Builder
Create a builder for the monitor actor. The monitor needs to be started before the listeners, and subscribed to the listeners using a named subject.
name- a name for the actor, to be used for subscribing to listener messagessubscriber- a subject to receive updates about services
pub fn search_target(
builder: Builder,
search_target: String,
) -> Builder
Set the search target for discovery messages (default ‘ssdp:all’)
pub fn start(
builder: Builder,
) -> Result(actor.Started(Monitor), actor.StartError)
Start a monitor actor. The monitor is not normally used directly, but as part of a supervision tree along with one or more listeners and discoverers.
pub fn supervisor(
config: Builder,
addr: glip.IpAddress,
) -> static_supervisor.Builder
Create a supervisor that will send out discovery requests, listen for replies and announcements, and track when services appear or disappear.
config: builder for the monitoraddr: IP address of the interface to broadcast and listen on