pub struct WebsocKitManager { /* private fields */ }
Implementations§
Source§impl WebsocKitManager
impl WebsocKitManager
pub fn new(payload_listener_tx: Sender<WebsocKitMessage>) -> Self
Sourcepub async fn handle_new_websocket(
self: &Arc<Self>,
socket: WebSocket,
) -> WebsocKitResult<ConnectionId>
pub async fn handle_new_websocket( self: &Arc<Self>, socket: WebSocket, ) -> WebsocKitResult<ConnectionId>
Splits the given Websocket connection into a sender/receiver, tracks the connection via an ID, listens for incoming socket packets, cleans up connection data once connection is lost.
Sourcepub async fn send_payload(
&self,
connection_ids: Vec<ConnectionId>,
payload: Vec<u8>,
) -> WebsocKitResult<()>
pub async fn send_payload( &self, connection_ids: Vec<ConnectionId>, payload: Vec<u8>, ) -> WebsocKitResult<()>
Send a payload to multiple websocket.
pub async fn send_payload_to_all_connections( &self, payload: Vec<u8>, ) -> WebsocKitResult<()>
pub async fn send_payload_to_subscribers( &self, subscription: Subscription, payload: Vec<u8>, ) -> WebsocKitResult<()>
Sourcepub async fn add_subscription(
&self,
connection_id: ConnectionId,
subscription: Subscription,
)
pub async fn add_subscription( &self, connection_id: ConnectionId, subscription: Subscription, )
Add a subscription for a websocket connection.
Sourcepub async fn remove_subscription(
&self,
connection_id: ConnectionId,
subscription: Subscription,
)
pub async fn remove_subscription( &self, connection_id: ConnectionId, subscription: Subscription, )
Remove a subscription for a websocket connection.
pub async fn remove_all_subscriptions(&self, connection_id: ConnectionId)
pub async fn get_subscriptions( &self, connection_id: ConnectionId, ) -> Option<HashMap<Subscription, usize>>
pub async fn get_subscribers( &self, subscription: Subscription, ) -> Vec<ConnectionId>
Auto Trait Implementations§
impl !Freeze for WebsocKitManager
impl !RefUnwindSafe for WebsocKitManager
impl Send for WebsocKitManager
impl Sync for WebsocKitManager
impl Unpin for WebsocKitManager
impl !UnwindSafe for WebsocKitManager
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
Mutably borrows from an owned value. Read more