Crate expo_server_sdk[][src]

Expo Push Notification Rust Client

The Expo Push Notification client provides a way for you to send push notifications to users of your mobile app using the Expo push notification services. For more details on the Expo push notification service, go here

Example: Sending a push notification

extern crate expo_server_sdk;
use expo_server_sdk::*;
use std::str::FromStr;

let token = PushToken::from_str("ExpoPushToken[my-token]").unwrap();
let mut msg = PushMessage::new(token).body("test notification");

let push_notifier = PushNotifier::new().gzip_policy(GzipPolicy::Always);
let result = push_notifier.send_push_notification(&msg);

if let Ok(result) = result {
    println!("Push Notification Response: \n \n {:#?}", result);
}

Structs

PushMessage

A PushMessage struct modelled after the one listed here:

PushNotifier

The PushNotifier takes one or more PushMessage to send to the push notification server

PushReceipt

See the Expo documentation on Push Notifications for details about the push notifications response from the server.

PushToken

A PushToken must be of the format ExpoPushToken[xxx] or ExponentPushToken[xxx].

Enums

GzipPolicy

The policy under which we will gzip the request body that is sent to the push notification servers

Priority

The delivery priority of the message. Specify "default" or omit this field to use the default priority on each platform, which is "normal" on Android and "high" on iOS.

Sound

A sound to play when the recipient receives this notification. Specify "default" to play the device's default notification sound, or omit this field to play no sound.