yell/service
Types, functions, and OTP actors for advertising an SSDP service.
Types
Configuration for a service that can be advertised on the network.
Create with new() and configure with with_location(), max_age(), and with_header().
pub opaque type ServiceConfig
Values
pub fn announce(
actor: actor.Started(Notifier),
status: yell.Status,
) -> Nil
Send a single notification with the specified status. Will stop any running loops.
pub fn announce_periodically(
actor: actor.Started(Notifier),
interval: Int,
) -> Nil
Start sending Alive notifications at a fixed interval (in milliseconds). Call this once to begin periodic notifications.
pub fn bind(
service: ServiceConfig,
interface: glip.IpAddress,
) -> ServiceConfig
pub fn max_age(
service: ServiceConfig,
max_age: Int,
) -> ServiceConfig
Configure the maximum time (in seconds) receivers should cache messages about this service. Typical values are 1800 (30 minutes) or 3600 (1 hour).
pub fn new(
service_type: String,
usn: String,
) -> Result(ServiceConfig, Nil)
Configure a new SSDP service.
service_type is a URI for the type of service provided, and usn is a URI with a unique name for the service.
Returns an error if either of these strings fails to parse to a URI.
pub fn start_notifier(
service: ServiceConfig,
) -> Result(actor.Started(Notifier), actor.StartError)
Start a notifier actor for a service. The notifier’s job is to send UDP multicast messages to the SSDP port announcing that the service is alive or is shutting down. The actor will not send any UDP messages until instructed to do so. Normally this actor is not used directly, but as a supervised child of the service actor.
pub fn start_replier(
service: ServiceConfig,
) -> Result(actor.Started(Nil), actor.StartError)
Start the replier actor. It will listen for discovery requests on the SSDP multicast address and automatically send replies for matching services. Normally this actor is not used directly, but as a supervised child of the service actor.
pub fn supervisor(
service: ServiceConfig,
interval: Int,
) -> static_supervisor.Builder
Create a supervisor that will send out notifications and reply to discovery requests.
This is the main entry point. You can pass this Builder to static_supervisor.start
or static_supervisor.supervised.
interval- how often to send out notifications, in ms
pub fn with_header(
service: ServiceConfig,
key: String,
value: String,
) -> ServiceConfig
Add a custom HTTP header to the messages sent by this service.
pub fn with_location(
service: ServiceConfig,
loc: String,
) -> ServiceConfig
Configure the location of the service. Typically a URL.