pub struct Client { /* private fields */ }
Expand description
Handles requests to and responses from Apple Push Notification service. Connects using a given connector. Handles the needed authentication and maps responses.
The send
method returns a future, which is successful when APNs receives
the notification and responds with a status OK. In any other case the future
fails. If APNs gives a reason for the failure, the returned Err
holds the response for handling.
Implementations§
source§impl Client
impl Client
sourcepub fn certificate<R>(
certificate: &mut R,
password: &str,
config: ClientConfig
) -> Result<Client, Error>where
R: Read,
pub fn certificate<R>(
certificate: &mut R,
password: &str,
config: ClientConfig
) -> Result<Client, Error>where
R: Read,
Create a connection to APNs using the provider client certificate which you obtain from your Apple developer account.
Only works with the openssl
feature.
sourcepub fn certificate_parts(
cert_pem: &[u8],
key_pem: &[u8],
config: ClientConfig
) -> Result<Client, Error>
pub fn certificate_parts( cert_pem: &[u8], key_pem: &[u8], config: ClientConfig ) -> Result<Client, Error>
Create a connection to APNs using the raw PEM-formatted certificate and key, extracted from the provider client certificate you obtain from your Apple developer account
sourcepub fn token<S, T, R>(
pkcs8_pem: R,
key_id: S,
team_id: T,
config: ClientConfig
) -> Result<Client, Error>
pub fn token<S, T, R>( pkcs8_pem: R, key_id: S, team_id: T, config: ClientConfig ) -> Result<Client, Error>
Create a connection to APNs using system certificates, signing every request with a signature using a private key, key id and team id provisioned from your Apple developer account.
sourcepub async fn send<T: PayloadLike>(&self, payload: T) -> Result<Response, Error>
pub async fn send<T: PayloadLike>(&self, payload: T) -> Result<Response, Error>
Send a notification payload.
See ErrorReason for possible errors.