SimTX API/Packets/Pong: Difference between revisions
Appearance
Protocol v25 reference |
Remove development history and server internals |
||
| Line 35: | Line 35: | ||
== Example == | == Example == | ||
Complete frames, including the varint length prefix | Complete frames, including the varint length prefix. | ||
'''<code>pong</code>''' (server to client, 19 bytes): | '''<code>pong</code>''' (server to client, 19 bytes): | ||
Latest revision as of 17:16, 24 October 2026
| Frame | ServerFrame, field 2
|
|---|---|
| Member | pong
|
| Direction | Server → client |
| Session | All roles |
| Roles | All roles. |
| Permission | None |
| Answers | Ping |
| Defined in | frames.proto
|
Pong answers a Ping. It echoes the ping's fields and adds the server clock.
Definition[edit | edit source]
message Pong { int64 nonce = 1; int64 client_time_ms = 2; int64 server_time_ms = 3; }
Fields[edit | edit source]
| # | Field | Type | Description |
|---|---|---|---|
| 1 | nonce |
int64 |
The ping's nonce.
|
| 2 | client_time_ms |
int64 |
The ping's client_time_ms.
|
| 3 | server_time_ms |
int64 |
Server clock when the ping was answered, Unix ms. |
Usage[edit | edit source]
Round-trip time is now − client_time_ms. An estimate of the server clock offset is server_time_ms − (client_time_ms + now) / 2.
Example[edit | edit source]
Complete frames, including the varint length prefix.
pong (server to client, 19 bytes):
12 frame length 18
12 10 pong (Pong), 16 bytes
08 63 nonce = 99
10 80 94 83 B9 97 34 client_time_ms = 1793000000000
18 8C 94 83 B9 97 34 server_time_ms = 1793000000012