Expand description
Provider-neutral push delivery with an Expo adapter.
The crate separates a small PushSender port from its ExpoPushSender
adapter. Domain code builds PushMessage values and reads PushOutcome
values; nothing above the port names a provider. Scheduling, quiet hours,
and deciding who gets notified stay in the product.
§Two-phase delivery
Expo answers a send with a ticket per notification, then confirms delivery
later through a receipt. ExpoPushSender runs both phases per batch, so
one call returns PushDeliveryStatus::Delivered or
PushDeliveryStatus::Rejected wherever Expo has settled, and
PushDeliveryStatus::Accepted where it has not. Never resend on
Accepted; the notification is in flight.
§Pruning dead tokens
A device token stops working once the app is uninstalled. Expo reports that
as DeviceNotRegistered, which becomes
PushRejection::DeviceNotRegistered. Delete those tokens after every
send, or the same failures repeat forever:
use baukit_push::{PushOutcome, PushSender};
async fn deliver(
sender: &impl PushSender,
messages: Vec<baukit_push::PushMessage>,
) -> Result<Vec<String>, baukit_push::PushError> {
let outcomes = sender.send(messages).await?;
Ok(outcomes
.iter()
.filter(|outcome| PushOutcome::is_token_dead(outcome))
.map(|outcome| outcome.token.clone())
.collect())
}§Retries
Whole-request failures arrive as PushError::Transport carrying a
baukit_http::RetryClass, so an Expo rate limit with a Retry-After
header reaches the caller as a concrete delay through
PushError::retry_after. Per-notification refusals are not errors:
inspect PushRejection::is_retryable on each outcome instead.
Structs§
- Expo
Push Sender - Expo push adapter.
- Push
Config - Deserializable push configuration for a product’s config section.
- Push
Message - One notification addressed to a single device token.
- Push
Options - Validated options an
ExpoPushSenderis built from. - Push
Outcome - What happened to one notification, keyed by the token it was addressed to.
Enums§
- Push
Delivery Status - The delivery state a provider reported for one notification.
- Push
Error - A failure that prevented the whole batch from being processed.
- Push
Options Error - Invalid push adapter configuration.
- Push
Rejection - Why a provider rejected one notification.
Constants§
- DEFAULT_
EXPO_ ENDPOINT - Expo’s public push send endpoint.
- MAX_
BATCH_ SIZE - Largest batch Expo accepts in one
/push/sendrequest.
Traits§
- Push
Sender - Outbound port for delivering notifications to devices.
Type Aliases§
- Push
Future - The future returned by
PushSender::send.