Dev's NoxDev's Nox
Relay Protocol

Latency

Latency test between client and server to measure connection quality.

The Latency message allows measuring the network latency between the client and the server.

It works through a round-trip system where the client sends a timestamp and receives its original timestamp back along with the server timestamp.

Priority

High - This message has a high priority to guarantee accurate measurements and can serve as a keep-alive.

The Latency message requires that the client has completed the Handshake. Requests sent before the handshake will be ignored by the server.


Use Cases

Keep-Alive

The client must send messages within a delay shorter than the connection timeout (15 seconds by default). The Latency message is ideal for keeping the connection active.

Performance Measurement

Allows evaluating the quality of the network connection and adjusting client behaviors according to the measured latency.

Time Synchronization

The timestamps allow synchronizing the client/server clocks for events requiring time precision.


Client Request → Server

Payload Format

[timestamp: DateTime]

Detailed Structure

TypeNameDescription
DateTimeTimestampUTC timestamp of the sending time

Payload Example

[2024-09-16T14:30:45.123Z]    // Client UTC timestamp

Server Response → Client

Payload Format

[client_timestamp: DateTime]
[server_timestamp: DateTime]

Detailed Structure

TypeNameDescription
DateTimeClientTimestampOriginal timestamp sent by the client
DateTimeServerTimestampUTC timestamp of the server at response time

Payload Example

[2024-09-16T14:30:45.123Z]    // Original client timestamp
[2024-09-16T14:30:45.156Z]    // Server timestamp

Latency Calculation

Client Side

RTT = (receive_time - client_timestamp)
Latency = RTT / 2
Server_Offset = server_timestamp - client_timestamp - Latency

Detailed Formula

  • RTT (Round-Trip Time): Total round-trip time
  • Latency: Estimated latency (RTT divided by 2)
  • Server Offset: Clock offset between client and server

On this page