Skip to main content

PushService

Trait PushService 

Source
pub trait PushService {
    // Required methods
    fn provider(&self) -> &str;
    fn prid(&self) -> &str;

    // Provided methods
    fn param(&self) -> Option<&str> { ... }
    fn device(&self) -> Result<Device, BuildError> { ... }
}
Expand description

The push notification service a device can be woken through (§3).

sipx implements this nowhere, and that is deliberate. Waking a device means speaking some vendor’s HTTP API over some vendor’s credentials, on a schedule that vendor sets — none of which is SIP, and all of which would date faster than the rest of this crate. What sipx needs from a push service is three strings, and this is them.

An implementation is an adapter the application writes over whatever it already uses to reach its push service. The tests use a stub for the same reason: there is nothing here that a real implementation would exercise differently.

Required Methods§

Source

fn provider(&self) -> &str

The pn-provider value naming this service (§8.7).

A value from the registry §8.8 creates. It is the name the registrar has to recognise, so inventing one produces a binding nothing will ever wake — see Support::supports.

Source

fn prid(&self) -> &str

The pn-prid value: the identifier this service knows the device by (§8.7).

Provided Methods§

Source

fn param(&self) -> Option<&str>

The pn-param value, when the service needs one (§8.7).

Service-specific and not SIP’s business, which is why the default is None.

Source

fn device(&self) -> Result<Device, BuildError>

The parameters a REGISTER’s Contact URI must carry to name this service (§4.1.2).

Fails when one of the three values is not something a URI parameter can hold; see [Device] for why that is checked here rather than discovered at the registrar.

Implementors§