dxFeed C API and dxFeed .NET API version 7.1.0 with fixes and improvements are already available.
C API Changelog
- Implemented the heartbeat semantics with payload
- Added the new function
dxf_set_on_server_heartbeat_notifier(dxf_connection_t connection, dxf_conn_on_server_heartbeat_notifier_t notifier, void* user_data)
that sets a server heartbeat notifier’s callback to the connection.
This notifier will be invoked when the new heartbeat arrives from a server and contains non empty payload
Function parameters:- connection – The handle of a previously created connection
- notifier – The notifier callback function pointer
- user_data – The data to be passed to the callback function
- Added the new callback type of a connection incoming heartbeat notification
dxf_conn_on_server_heartbeat_notifier_t
Passed parameters:- connection – The connection handle
- server_millis – The server time in milliseconds (from the incoming heartbeat payload)
- server_lag_mark – The server’s messages composing lag time in microseconds (from the incoming heartbeat payload)
- connection_rtt – The calculated connection RTT in microseconds
- user_data – The user data passed to dxf_set_on_server_heartbeat_notifier
An example of implementation:
void on_server_heartbeat_notifier(dxf_connection_t connection, dxf_long_t server_millis, dxf_int_t server_lag_mark, dxf_int_t connection_rtt, void* user_data) { fwprintf(stderr, L"\n##### Server time (UTC) = %" PRId64 " ms, Server lag = %d us, RTT = %d us #####\n", server_millis, server_lag_mark, connection_rtt); }
See usage example in the CommandLineSample.c
- Added the new function
.NET API Changelog
- Implemented the heartbeat semantics with payload
-
Added the new method
NativeConnection.SetOnServerHeartbeatHandler(OnServerHeartbeatHandler handler)
that sets a handler that will be called when a server heartbeat arrives and contains non empty payload -
Added the new delegate type
delegate void OnServerHeartbeatHandler(IDxConnection connection, DateTime serverDateTime, int serverLagMark, int connectionRtt)
which is describes the handler type of a connection’s incoming heartbeat notification
Passed parameters:- connection – The current connection object
- serverDateTime – The server UTC time (from the incoming heartbeat payload)
- serverLagMark – The server’s messages composing lag time in microseconds (from the incoming heartbeat payload)
- connectionRtt – The calculated connection RTT in microseconds
An example of usage:
connection.SetOnServerHeartbeatHandler((connection, time, lagMark, rtt) => { Console.Error.WriteLine($"##### Server time (UTC) = {time}, Server lag = {lagMark} us, RTT = {rtt} us #####"); });
-