Struct naia_client::NaiaClient [−][src]
Client can send/receive events to/from a server, and has a pool of in-scope actors that are synced with the server
Implementations
impl<T: EventType, U: ActorType> NaiaClient<T, U>
[src]
impl<T: EventType, U: ActorType> NaiaClient<T, U>
[src]pub fn new(
server_address: SocketAddr,
manifest: Manifest<T, U>,
client_config: Option<ClientConfig>,
shared_config: SharedConfig,
auth: Option<T>
) -> Self
[src]
server_address: SocketAddr,
manifest: Manifest<T, U>,
client_config: Option<ClientConfig>,
shared_config: SharedConfig,
auth: Option<T>
) -> Self
Create a new client, given the server’s address, a shared manifest, an optional Config, and an optional Authentication event
pub fn receive(&mut self) -> Option<Result<ClientEvent<T>, NaiaClientError>>
[src]
Must call this regularly (preferably at the beginning of every draw frame), in a loop until it returns None. Retrieves incoming events/updates, and performs updates to maintain the connection.
pub fn send_event(&mut self, event: &impl Event<T>)
[src]
Queues up an Event to be sent to the Server
pub fn send_command(&mut self, pawn_key: LocalActorKey, command: &impl Event<T>)
[src]
Queues up an Command to be sent to the Server
pub fn server_address(&self) -> SocketAddr
[src]
Get the address currently associated with the Server
pub fn has_connection(&self) -> bool
[src]
Return whether or not a connection has been established with the Server
pub fn get_actor(&mut self, key: &LocalActorKey) -> Option<&U>
[src]
Get a reference to an Actor currently in scope for the Client, given that Actor’s Key
pub fn actor_keys(&self) -> Option<Vec<LocalActorKey>>
[src]
Return an iterator to the collection of keys to all actors tracked by the Client
pub fn get_pawn(&mut self, key: &LocalActorKey) -> Option<&U>
[src]
Get a reference to a Pawn
pub fn get_pawn_mut(&mut self, key: &LocalActorKey) -> Option<&U>
[src]
Get a reference to a Pawn, used for setting it’s state
pub fn pawn_keys(&self) -> Option<Vec<LocalActorKey>>
[src]
Return an iterator to the collection of keys to all Pawns tracked by the Client
pub fn get_rtt(&self) -> f32
[src]
Gets the average Round Trip Time measured to the Server
pub fn get_jitter(&self) -> f32
[src]
Gets the average Jitter measured in connection to the Server
pub fn get_client_tick(&self) -> u16
[src]
Gets the current tick of the Client
pub fn get_server_tick(&self) -> u16
[src]
Gets the last received tick from the Server
Trait Implementations
Auto Trait Implementations
impl<T, U> !RefUnwindSafe for NaiaClient<T, U>
impl<T, U> !RefUnwindSafe for NaiaClient<T, U>
impl<T, U> !Send for NaiaClient<T, U>
impl<T, U> !Send for NaiaClient<T, U>
impl<T, U> !Sync for NaiaClient<T, U>
impl<T, U> !Sync for NaiaClient<T, U>
impl<T, U> Unpin for NaiaClient<T, U> where
T: Unpin,
U: Unpin,
impl<T, U> Unpin for NaiaClient<T, U> where
T: Unpin,
U: Unpin,
impl<T, U> !UnwindSafe for NaiaClient<T, U>
impl<T, U> !UnwindSafe for NaiaClient<T, U>