onDataMessage
onDataMessage
Called when a socket-type Provider Instance receives an interim status message that the server sends before completing its response to a normal request (requestData/requestNextData). It's a side notification channel that doesn't end the request.
Parameters
provInstName(string): The name of the Provider Instance that sent the requestcode(string): The message status codemessage(string): The message content
Returns: No return value — this is a callback, so its return value isn't used.
Description
This event has nothing to do with real-time subscriptions (subscribeData). It fires when, after a normal requestData/requestNextData call to a socket-type Provider Instance, the server sends an interim status or notification message before finishing its response. It never fires for HTTP (OpenAPI) Provider Instances. Unlike onReceiveError, which ends the request in failure, the request is still in flight when this fires and goes on to onReceiveDone.
Example
function onDataMessage(provInstName, code, message) {
$log.i(provInstName + " notice " + code + ": " + message);
}
Related
- It doesn't fire for ordinary HTTP (OpenAPI) Provider Instances — only socket-type ones.
- Because it doesn't end the request, it can fire several times within a single request cycle.
- The event originated in one app's trading (TR) flow, but the engine itself is general purpose, so other socket-based providers can use it the same way.