Server ping
Server ping
27 Oct 2023, 05:34
I see some old threads about being able to get server ping with the old API, is it possible with the current Open API? I haven't found anything in the code or documentation.
Thanks!
Replies
kemenist
27 Oct 2023, 06:16
RE: Server ping
PanagiotisChar said:
Hi there,
You get heartbeats from the server, why do you need a ping?
Sorry, to clarify I mean the one-way latency to the server.
@kemenist
raypang
23 May 2024, 08:44
( Updated at: 23 May 2024, 09:42 )
RE: RE: Server ping
kemenist said:
PanagiotisChar said:
Hi there,
You get heartbeats from the server, why do you need a ping?
Sorry, to clarify I mean the one-way latency to the server.
if you using python websockets library, you can use ping to get latency, example code:
async def _auto_ping(self, interval:int, connection:WebSocketClientProtocol):
while True:
await asyncio.sleep(interval)
future_pong = await connection.ping()
# print('', end='♡')
latency = await future_pong
# print('', end=f'❤︎')
@raypang
PanagiotisChar
27 Oct 2023, 06:04
Hi there,
You get heartbeats from the server, why do you need a ping?
@PanagiotisChar