pub struct RUMServer { /* private fields */ }Expand description
This is the Server primitive that listens for incoming connections and manages “low-level” messages.
This struct tracks accepting new clients via RUMServer::handle_accept, incoming messages via [RUMServer::handle_receive] and message dispatchs via [RUMServer::handle_send].
All key methods are async and shall be run exclusively in the async context. We provide a set of tools that allow you to interact with this struct from sync code. One such tool is RUMServerHandle.
The [RUMServer::run] method orchestrate a series of steps that allows starting server management. The result is that the server will check for connections and messages autonomously. You want to call this method in a non blocking manner from the sync context, so that the server can handle the transactions in the background
Implementations§
Source§impl RUMServer
impl RUMServer
Sourcepub async fn new(ip: &str, port: u16) -> RUMResult<RUMServer>
pub async fn new(ip: &str, port: u16) -> RUMResult<RUMServer>
Constructs a server and binds the port on interface denoted by ip. The server
management is not started until you invoke [Self::run].
Sourcepub async fn handle_accept(listener: SafeListener, clients: RUMNetClients)
pub async fn handle_accept(listener: SafeListener, clients: RUMNetClients)
Contains basic logic for listening for incoming connections.
pub async fn _handle_accept( listener: &SafeListener, clients: &RUMNetClients, ) -> RUMResult<()>
pub async fn receive( &self, client_id: &RUMString, blocking: bool, ) -> RUMResult<RUMNetMessage>
pub async fn send( &self, client_id: &RUMString, msg: &RUMNetMessage, ) -> RUMResult<()>
pub async fn disconnect(client: &RUMNetClient)
pub async fn get_client(&self, client: &RUMString) -> RUMResult<RUMNetClient>
Sourcepub async fn get_client_ids(&self) -> ClientIDList
pub async fn get_client_ids(&self) -> ClientIDList
Return client id list.
pub async fn get_client_id(client: &RUMNetClient) -> RUMString
Sourcepub async fn get_clients(&self) -> ClientList
pub async fn get_clients(&self) -> ClientList
Return list of clients.
Sourcepub async fn get_address_info(&self) -> Option<RUMString>
pub async fn get_address_info(&self) -> Option<RUMString>
Get the Address:Port info for this socket.