Skip to content

back2mach/apns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apns

APNS(Apple Push Notification Service) implemented in Rust

Build Status

Config

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

Payload Alert(Plain Format)

let alert = apns::PayloadAPSAlert::Plain("Hello world");

Payload Alert(Localized Format)

let alert = apns::PayloadAPSAlert::Localized(loc_key, loc_args);

Send Payload

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

Feedback Service

apns.get_feedback();

About

APNS(Apple Push Notification Service) implemented in Rust

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages