Herbeat and Test request function 'meaning

Created at 02 Nov 2022, 20:26
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!
EM

emahohaz

Joined 02.11.2022

Herbeat and Test request function 'meaning
02 Nov 2022, 20:26


hi, i was studying the Fix Api sample written in C# and i am wondering if anyobody can explain to me how Herbeatmessage and Testrequestmessage function works.I mean i understood what type of logic this function calls but not the real essence of them. How can i deploy them in order to get a continuos connection with my broker's server?


@emahohaz
Replies

ctid1980098
03 Nov 2022, 10:21

RE:

emahohaz said:

hi, i was studying the Fix Api sample written in C# and i am wondering if anyobody can explain to me how Herbeatmessage and Testrequestmessage function works.I mean i understood what type of logic this function calls but not the real essence of them. How can i deploy them in order to get a continuos connection with my broker's server?

Hi emahohaz

I've just barely written my first FIX application so my answer may not be totally correct. Anyway this is what i use heartbeat messages for. 

When logging into a price or trade stream I set my heartbeat to 30 seconds. This will send a heartbeat message every 30 seconds from server to me. 

The reason i set this is to make sure I have a connection to the server. So on my client application i check to see if a heartbeat message has been received every 30 seconds. 

If not, then i initiate a closing of the connection and attempt to reconnect to the server again. You can set the heartbeat time to even lower and continously check on your application if these messages are being received. 

Note that you should respond to the heartbeat message when received as well. 

Hope this helps


@ctid1980098

PanagiotisChar
03 Nov 2022, 11:04

Hi there,

Heartbeats are used to keep the connection alive when there is no other activity. If you fail to send a heartbeat, the server will eventually close the connection and you will need to connect and authenticate again.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@PanagiotisChar

emahohaz
05 Nov 2022, 11:00

RE:

PanagiotisChar said:

Hi there,

Heartbeats are used to keep the connection alive when there is no other activity. If you fail to send a heartbeat, the server will eventually close the connection and you will need to connect and authenticate again.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

thank you!!

 


@emahohaz

emahohaz
05 Nov 2022, 11:01

RE: RE:

ctid1980098 said:

emahohaz said:

hi, i was studying the Fix Api sample written in C# and i am wondering if anyobody can explain to me how Herbeatmessage and Testrequestmessage function works.I mean i understood what type of logic this function calls but not the real essence of them. How can i deploy them in order to get a continuos connection with my broker's server?

Hi emahohaz

I've just barely written my first FIX application so my answer may not be totally correct. Anyway this is what i use heartbeat messages for. 

When logging into a price or trade stream I set my heartbeat to 30 seconds. This will send a heartbeat message every 30 seconds from server to me. 

The reason i set this is to make sure I have a connection to the server. So on my client application i check to see if a heartbeat message has been received every 30 seconds. 

If not, then i initiate a closing of the connection and attempt to reconnect to the server again. You can set the heartbeat time to even lower and continously check on your application if these messages are being received. 

Note that you should respond to the heartbeat message when received as well. 

Hope this helps

thank you for your help!!

much appreciated

@emahohaz