pub struct WebPushClient {
pub uaid: Uuid,
pub uid: Uuid,
pub ua_info: UserAgentInfo,
/* private fields */
}Expand description
A WebPush Client that’s successfully identified itself to the server via a Hello message.
The webpush_ws handler feeds input from both the WebSocket connection
(ClientMessage) and the ClientRegistry (ServerNotification)
triggered by autoendpoint to this type’s on_client_msg and
on_server_notif methods whose impls reside in their own modules.
Note the check_storage method (in the on_server_notif module) is
triggered by both a ServerNotification and also the new constructor
Fields§
§uaid: UuidPush User Agent identifier. Each Push client recieves a unique UAID
uid: UuidUnique, local (to each autoconnect instance) identifier
ua_info: UserAgentInfoThe User Agent information block derived from the User-Agent header
Implementations§
Source§impl WebPushClient
impl WebPushClient
Sourcepub async fn on_client_msg(
&mut self,
msg: ClientMessage,
) -> Result<Vec<ServerMessage>, SMError>
pub async fn on_client_msg( &mut self, msg: ClientMessage, ) -> Result<Vec<ServerMessage>, SMError>
Handle a WebPush ClientMessage sent from the user agent over the
WebSocket for this user
Source§impl WebPushClient
impl WebPushClient
Sourcepub async fn on_server_notif(
&mut self,
snotif: ServerNotification,
) -> Result<Vec<ServerMessage>, SMError>
pub async fn on_server_notif( &mut self, snotif: ServerNotification, ) -> Result<Vec<ServerMessage>, SMError>
Handle a ServerNotification for this user
ServerNotification::Disconnect is emitted by the same autoconnect
node receiving it when a User has logged into that same node twice to
“Ghost” (disconnect) the first user’s session for its second session.
Other variants are emitted by autoendpoint
Sourcepub fn on_server_notif_shutdown(&mut self, snotif: ServerNotification)
pub fn on_server_notif_shutdown(&mut self, snotif: ServerNotification)
After disconnecting from the ClientRegistry, moves any queued Direct
Push Notifications to unacked_direct_notifs (to be stored in the db on
shutdown)
Source§impl WebPushClient
impl WebPushClient
pub async fn new( uaid: Uuid, ua: String, broadcast_subs: BroadcastSubs, flags: ClientFlags, connected_at: u64, current_timestamp: Option<u64>, deferred_add_user: Option<User>, app_state: Arc<AppState>, ) -> Result<(Self, Vec<ServerMessage>), SMError>
Sourcepub fn app_settings(&self) -> &Settings
pub fn app_settings(&self) -> &Settings
Return a reference to AppState’s Settings
pub fn app_reliability(&self) -> &PushReliability
Sourcepub async fn registry_connect(&self) -> UnboundedReceiver<ServerNotification>
pub async fn registry_connect(&self) -> UnboundedReceiver<ServerNotification>
Connect this WebPushClient to the ClientRegistry
Returning a Stream of ServerNotifications from the ClientRegistry
Sourcepub async fn registry_disconnect(&self)
pub async fn registry_disconnect(&self)
Disconnect this WebPushClient from the ClientRegistry
Sourcepub async fn broadcast_delta(&mut self) -> Option<Vec<Broadcast>>
pub async fn broadcast_delta(&mut self) -> Option<Vec<Broadcast>>
Return the difference between the Client’s Broadcast Subscriptions and the this server’s Broadcasts
Sourcepub fn add_sentry_info(self, event: &mut Event<'_>)
pub fn add_sentry_info(self, event: &mut Event<'_>)
Add User information and tags for this Client to a Sentry Event