Server ping

Created at 27 Oct 2023, 05:34
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
KE

kemenist

Joined 19.01.2022

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!


@kemenist
Replies

PanagiotisChar
27 Oct 2023, 06:04

Hi there,

You get heartbeats from the server, why do you need a ping?


@PanagiotisChar

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