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 fn registry_connect(&self) -> Receiver<ServerNotification>
pub fn registry_connect(&self) -> Receiver<ServerNotification>
Connect this WebPushClient to the ClientRegistry
Returning a Stream of ServerNotifications from the ClientRegistry
Sourcepub fn registry_disconnect(&self)
pub 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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WebPushClient
impl !RefUnwindSafe for WebPushClient
impl Send for WebPushClient
impl Sync for WebPushClient
impl Unpin for WebPushClient
impl !UnwindSafe for WebPushClient
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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