ping()

Client.ping()

Measure the round-trip time (RTT) to the Telegram server.

The ping method sends a request to the Telegram server and measures the time it takes to receive a response. This can be useful for monitoring network latency and ensuring a stable connection to the server.

Returns:

float – The round-trip time in milliseconds (ms).

Example

latency = await app.ping()
print(f"Ping: {latency} ms")