Caplin Trader 4.7.1

Interface: module:caplin/services/messaging/SubscriptionListener

module:caplin/services/messaging/SubscriptionListener

Interface implemented by classes that wish to listen to subscription events.
Implementations:

Methods

onDataUpdate(subject, data, metadata)

Called when an update is received for the subscribed record.
Parameters:
Name Type Description
subject String The subject of the record that the update is for.
data Map The updated data.
metadata Map Meta data for the update.
Properties
Name Type Description
isImage Boolean Whether the update is an image or not.
latency Number The latency of the record in milliseconds.
timeReceived Number The time that the update was received in milliseconds since 1 January 1970 00:00:00 UTC.
Implementations:
  • module:caplin/trading/trademodel/StreamingInstrumentDataSubscriber#onDataUpdate

onError(subject, errorType)

Called when there is an error with the subscription.
Parameters:
Name Type Description
subject String The subject of the record that had an error.
errorType module:caplin/services/messaging/SubscriptionError The type of error.
Implementations:
  • module:caplin/trading/trademodel/StreamingInstrumentDataSubscriber#onError

onStatusUpdate(subject, status)

Called when the status of the subscription changes.
Parameters:
Name Type Description
subject String The subject of the record that changed status.
status module:caplin/services/messaging/SubscriptionStatus The new status of the subscription.
Implementations:
  • module:caplin/trading/trademodel/StreamingInstrumentDataSubscriber#onStatusUpdate