Struct wemo::subscriptions::Subscriptions [] [src]

pub struct Subscriptions { /* fields omitted */ }

Subscriptions objects manage Wemo device event notifications. You can register subscriptions against multiple devices; an Iron HTTP server will be started to receive callback notifications from the Wemo devices, and a background thread will handle subscription management. You should only ever need one of these objects.

Methods

impl Subscriptions
[src]

CTOR. Set the callback port for the HTTP server that will be launched and the subscription TTL.

Subscribe to push notifications from a Wemo device. The provided callback is invoked when notifications are received. This should be done after launching the server to avoid missing notifications.

Remove a subscription.

Start the HTTP server so it can begin receiving push notifications. A background thread to resubscribe will also be launched. Calling this function is nonblocking, but it returns a thread guard that will automatically join with the parent once it is dropped.

Stop the HTTP server from running. Also stops resubscription process. Warning: This may not work the server from listening. See the following issue on Iron/Hyper: https://github.com/hyperium/hyper/issues/338