A Rust crate for sending push notifications to iOS devices via the APNS http/2 API.
use apple_push::ApplePushClient;
use hyper_tls::HttpsConnector;
use tokio::runtime::Runtime;
let connector = HttpsConnector::new(4);
let apns = ApplePushClient::new(connector, "TEAM_ID", "KEY_ID", "KEY");
let notification = NotificationBuilder::new("TOPIC", "DEVICE_TOKEN")
.title("TITLE")
.body("BODY")
.sound("SOUND_FILE")
.badge(5)
.build();
let mut rt = Runtime::new().unwrap();
rt.block_on(apns.send(n)).unwrap();This library is based on apns2-rust which uses cURL bindings and only supports certificate authentication. It has been rewritten to use hyper and JSON web token authentication. A fork of jsonwebtoken is currently used to add ECDSA support.
A TLS connector must be provided; the example above uses hyper-tls. Sadly, due to an issue with the Ring crypto library, rustls cannot be used, because the jsonwebtoken fork uses a newer version of ring than rustls does (to get ECDSA signing support) and ring does not support multiple versions being linked into the same project.
This library is dual-licensed under Apache and MIT.
Check the license files in this repo for details.