WebsocketServer

Struct WebsocketServer 

Source
pub struct WebsocketServer { /* private fields */ }

Implementations§

Source§

impl WebsocketServer

Source

pub fn new() -> Self

Source

pub async fn start(&mut self, url: Option<String>) -> Result<()>

Source

pub fn take_recv_channel(&mut self) -> Option<Receiver<InboundMessage>>

Source

pub fn get_send_channel(&self) -> Sender<OutboundMessage>

Source

pub async fn send_socket_message( &self, socket_message: SocketMessage, destination: OutboundMessageDestination, ) -> Result<(), WebsocketServerError>

Source

pub fn send_outbound_message( &self, msg: OutboundMessage, ) -> Result<(), WebsocketServerError>

Source

pub async fn clear_pending_reliable_message( pending_reliable_messages: Arc<RwLock<HashMap<String, OutboundMessage>>>, message_uuid: String, )

Source

pub async fn try_send_outbound_messages( clients_map: Arc<RwLock<HashMap<String, ClientConnection>>>, rooms_map: Arc<RwLock<HashMap<String, HashSet<String>>>>, global_send_rx: Receiver<OutboundMessage>, ) -> Result<()>

Source

pub async fn add_client_to_room( &self, client_connection_uuid: String, room_name: String, )

Source

pub async fn remove_client_from_room( &self, client_connection_uuid: String, room_name: String, )

Source

pub async fn broadcast( clients_map: Arc<RwLock<HashMap<String, ClientConnection>>>, rooms_map: Arc<RwLock<HashMap<String, HashSet<String>>>>, outbound_message: OutboundMessage, ) -> Result<(), WebsocketServerError>

Source

pub async fn broadcast_to_connections( connections: Vec<ClientConnection>, socket_message: SocketMessage, ) -> Result<(), WebsocketServerError>

Source

pub async fn try_accept_new_connections( clients_map: Arc<RwLock<HashMap<String, ClientConnection>>>, listener: TcpListener, global_recv_tx: Sender<InboundMessage>, global_send_tx: Sender<OutboundMessage>, ws_server_events_tx: Sender<WebsocketSystemEvent>, ) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,