Caplin Trader 5.1.0

Interface: module:ct-services/messaging/SubscriptionListener

module:ct-services/messaging/SubscriptionListener

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

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.

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:ct-services/messaging/SubscriptionError

The type of error.

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:ct-services/messaging/SubscriptionStatus

The new status of the subscription.