https://github.com/expo/expo-server-sdk-rust
Server side library for working with Expo using Rust. Includes a client to send push notifications to users of your mobile app using the Expo push notification services.
https://github.com/expo/expo-server-sdk-rust
Last synced: 6 months ago
JSON representation
Server side library for working with Expo using Rust. Includes a client to send push notifications to users of your mobile app using the Expo push notification services.
- Host: GitHub
- URL: https://github.com/expo/expo-server-sdk-rust
- Owner: expo
- License: mit
- Created: 2018-07-05T05:27:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-02-15T19:16:47.000Z (over 1 year ago)
- Last Synced: 2025-04-08T12:09:45.680Z (6 months ago)
- Language: Rust
- Size: 11.7 KB
- Stars: 22
- Watchers: 1
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
⚠️ This Rust push notifications client library is no longer actively maintained. We recommend using [expo-push-notificaton-client-rust](https://github.com/katayama8000/expo-push-notification-client-rust).
# 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] (https://docs.expo.io/versions/latest/guides/push-notifications)
## 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);
}
```## Example: Using the cli tool
```
# Send a push notification with a body, passing in the push token
expo-server --body="test notification" ExpoPushToken[my-token]
```Receives the response:
```
Push Notification Response:
PushReceipt {
status: "error",
message: Some(
"\"ExpoPushToken[my-token]\" is not a registered push notification recipient"
),
details: Some(
Object(
{
"error": String(
"DeviceNotRegistered"
)
}
)
)
}
```