naia_client/client_config.rs
1use std::{default::Default, time::Duration};
2
3use naia_shared::ConnectionConfig;
4
5/// Contains Config properties which will be used by a Server or Client
6#[derive(Clone)]
7pub struct ClientConfig {
8 /// Used to configure the connection with the Server
9 pub connection: ConnectionConfig,
10 /// The duration between the resend of certain connection handshake messages
11 pub send_handshake_interval: Duration,
12 /// The duration to wait before sending a ping message to the remote host,
13 /// in order to estimate RTT time
14 pub ping_interval: Duration,
15 /// The number of network samples to take before completing the Connection Handshake.
16 /// Increase this for greater accuracy of network statistics, at the cost of the handshake
17 /// taking longer. Keep in mind that the network measurements affect how likely commands
18 /// are able to arrive at the server before processing.
19 pub handshake_pings: u8,
20}
21
22impl Default for ClientConfig {
23 fn default() -> Self {
24 Self {
25 connection: ConnectionConfig::default(),
26 send_handshake_interval: Duration::from_millis(250),
27 ping_interval: Duration::from_secs(1),
28 handshake_pings: 10,
29 }
30 }
31}