pub trait ConnectorParam {
    type TSend: for<'a> Deserialize<'a> + Serialize + Debug + Eq + PartialEq;
    type TReceive: for<'a> Deserialize<'a> + Serialize + Debug + Eq + PartialEq;

    const PING_INTERVAL_S: f64 = 0.5f64;
    const REQUEST_MISSING_PACKET_INTERVAL_S: f64 = 1f64;
    const EMIT_UNCONFIRMED_PACKET_INTERVAL_S: f64 = 1f64;
    const RECEIVE_PING_TIMEOUT_S: f64 = _;
    const SEND_PING_TIMEOUT_S: f64 = _;
}
Expand description

Settings that are set up for a Connector. This can be used to tweak your Connector at compile-time

Required Associated Types

The type that this connector will be sending. This is usually an enum.


// For the server:
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
pub enum ServerToClient {
    LoginResult { success: bool },
}

struct ConnectorConfig;


impl ConnectorParam for ConnectorConfig {
    type TSend = ServerToClient;
    // Other fields omitted
}

The type that this connector will be sending. This is usually an enum.



// For the server:
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
pub enum ClientToServer {
    Login { params: AuthenticateParams },
}

struct ConnectorConfig;

impl ConnectorParam for ConnectorConfig {
    type TReceive = ClientToServer;
    // Other fields omitted
}

Provided Associated Constants

The interval at which pings are being emitted to the other connector. This should be set in relation to RECEIVE_PING_TIMEOUT_S and SEND_PING_TIMEOUT_S, and how often you expect to lose packets.

The interval at which missing packets are being requested from the connector

The interval at which unconfirmed packets are being send to the other connector

The time that it takes before this connector assumes it has lost connection to the other connector

The time that it takes before this connector assumes it has lost connection to the other connector

Implementors