1个不稳定版本
使用旧版Rust 2015
0.1.0 | 2018年7月5日 |
---|
在 #push-notification 中排名第9
19KB
339 行(不含注释)
Expo Push Notification Rust客户端
Expo Push Notification客户端允许您使用Expo推送通知服务向您的移动应用用户发送推送通知。有关Expo推送通知服务的更多详情,请访问[这里] (https://docs.expo.io/versions/latest/guides/push-notifications)
示例:发送推送通知
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);
}
示例:使用cli工具
# Send a push notification with a body, passing in the push token
expo-server --body="test notification" ExpoPushToken[my-token]
接收响应
Push Notification Response:
PushReceipt {
status: "error",
message: Some(
"\"ExpoPushToken[my-token]\" is not a registered push notification recipient"
),
details: Some(
Object(
{
"error": String(
"DeviceNotRegistered"
)
}
)
)
}
依赖项
~18–28MB
~481K SLoC