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: Uuid
Push User Agent identifier. Each Push client recieves a unique UAID
uid: Uuid
Unique, local (to each autoconnect instance) identifier
ua_info: UserAgentInfo
The 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 recieving 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 ServerNotification
s 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
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