Skip to content

About

APNS (Apple Push Notification Service) library for Rust.

Resources

Stars

3 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apple-push

A Rust crate for sending push notifications to iOS devices via the APNS http/2 API.

Usage

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();

Client

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.

License

This library is dual-licensed under Apache and MIT.

Check the license files in this repo for details.

About

APNS (Apple Push Notification Service) library for Rust.

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages