pub struct PushRelayClient { /* private fields */ }Expand description
Push relay client for forwarding device tokens and sending push notifications via the centralized push relay service (Cloudflare Worker).
The bridge never holds APNs/FCM credentials. It only knows the relay URL and authenticates via a short-lived RS256 JWT fetched from the token service.
Implementations§
Source§impl PushRelayClient
impl PushRelayClient
Sourcepub fn new(relay_url: String, _relay_token: String) -> Self
pub fn new(relay_url: String, _relay_token: String) -> Self
Create a new push relay client.
relay_url: Base URL of the push relay (e.g., “https://push.aptove.com”)_relay_token: Kept for API compatibility; unused when JWT credentials are set
Sourcepub fn with_jwt_credentials(
self,
token_url: String,
client_id: String,
client_secret: String,
) -> Self
pub fn with_jwt_credentials( self, token_url: String, client_id: String, client_secret: String, ) -> Self
Configure JWT authentication credentials from the token service.
Sourcepub async fn register_device(
&self,
device_token: &str,
platform: &str,
bundle_id: Option<&str>,
) -> Result<()>
pub async fn register_device( &self, device_token: &str, platform: &str, bundle_id: Option<&str>, ) -> Result<()>
Register a device token with the push relay.
Called when the mobile app sends bridge/registerPushToken over WebSocket.
Sourcepub async fn unregister_device(&self, device_token: &str) -> Result<()>
pub async fn unregister_device(&self, device_token: &str) -> Result<()>
Unregister a device token from the push relay.
Sourcepub async fn notify(&self, agent_name: &str) -> Result<bool>
pub async fn notify(&self, agent_name: &str) -> Result<bool>
Send a push notification via the relay.
Includes per-agent debounce: if a notification was sent within the cooldown window (default 30s), the new one is silently dropped.
The notification content is fixed (“Your agent has new activity”) to prevent leaking agent response content.
Trait Implementations§
Source§impl Clone for PushRelayClient
impl Clone for PushRelayClient
Source§fn clone(&self) -> PushRelayClient
fn clone(&self) -> PushRelayClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PushRelayClient
impl !RefUnwindSafe for PushRelayClient
impl Send for PushRelayClient
impl Sync for PushRelayClient
impl Unpin for PushRelayClient
impl UnsafeUnpin for PushRelayClient
impl !UnwindSafe for PushRelayClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more