[][src]Trait naia_server_socket::ServerSocketTrait

pub trait ServerSocketTrait {
#[must_use]    fn listen<'async_trait>(
        socket_address: SocketAddr,
        config: Option<Config>
    ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
    where
        Self: 'async_trait
;
#[must_use] fn receive<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<SocketEvent, NaiaServerSocketError>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn get_sender(&mut self) -> MessageSender; }

Defines the functionality of a Naia Server Socket

Required methods

#[must_use]fn listen<'async_trait>(
    socket_address: SocketAddr,
    config: Option<Config>
) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>> where
    Self: 'async_trait, 

Creates a new Server Socket, listening at a given address, and taking an optional Config

#[must_use]fn receive<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<SocketEvent, NaiaServerSocketError>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Receive a new packet from the socket, or a tick event

fn get_sender(&mut self) -> MessageSender

Gets a MessageSender you can use to send messages through the Server Socket

Loading content...

Implementors

Loading content...