Crates.io | apns |
lib.rs | apns |
version | 0.1.1 |
source | src |
created_at | 2015-02-22 08:45:45.105507 |
updated_at | 2015-12-25 16:01:55.781482 |
description | Library for Apple Push Notification Service. |
homepage | https://github.com/back2mach/apns |
repository | https://github.com/back2mach/apns |
max_upload_size | |
id | 1448 |
size | 25,181 |
APNS(Apple Push Notification Service) implemented in Rust
let cert_file = Path::new("ck.pem");
let private_key_file = Path::new("no_pwd.pem");
let ca_file = Path::new("ca.pem");
let sandbox_environment = false;
let apns = apns::APNS::new(sandbox_environment, cert_file, private_key_file, ca_file);
let alert = apns::PayloadAPSAlert::Plain("Hello world");
let alert = apns::PayloadAPSAlert::Localized(loc_key, loc_args);
let aps = apns::PayloadAPS{alert: alert, badge: Some(1), sound: Some(sound), content_available: None};
// Custom data
let mut map = HashMap::new();
map.insert("source_id", "from");
map.insert("target_id", "to");
map.insert("message_type", "msg");
let payload = apns::Payload{aps: aps, info: Some(map)};
apns.send_payload(payload, device_token);
apns.get_feedback();