Refinitiv Data Library for TypeScript

RDPStream.Event

Summary

RDPStream.Event provides a set of events that can be emitted by RDPStream:

RDPStream.Event.Response

Description: full data of requested universe items

Parameters:

  • Full data of requested universe items
  • The RDPStream object that emitted the event

RDPStream.Event.Update

Description: Update events are emitted when fields of the requested instrument change. Update events only contain the fields and values that changed. When the application receives an Update it must update its internal representation of the instrument (if any) accordingly.

Parameters:

  • The updated fields with their new values
  • The RDPStream object that emitted the event

RDPStream.Event.Ack

Description: ack events are emitted when the status of one of the requested instrument changes.

Parameters:

  • The new status of the instrument
  • The RDPStream object that emitted the event

RDPStream.Event.Complete

Description: Complete event is emitted once the requested instrument received either a Refresh or a Status event. The Complete event indicates that the Pricing.Stream object is Complete and that it's internal cache contains the full data set (instruments and fields) that were requested.

Parameter:

  • The RDPStream object that is Complete

RDPStream.Event.Error

Description: Error event is emitted when an error message is received for the requested instrument.

Parameters:

  • Error object that contains an error message
  • The RDPStream object that emitted the event

RDPStream.Event.StateChanged

Description: StateChanged event is emitted when the RDPStream state is changed.

Parameters:

  • The RDPStream object that emitted the event
  • The new state of the RDPStream. It can be: State.Opened, State.Pending, State.Closed

Side note: As Response events and Update events use event handlers with the same signature, the same handler can be used for these 2 event types if you do not need to distinguish them.

Events order in case of successful response for the RDPStream:
[StateChanged:Pending] -> [StateChanged:Opened] -> Response -> Complete -> Update -> ... -> Update -> [StateChanged: Closed]

Events order in case of error response for the RDPStream:
[StateChanged:Pending] -> Status -> Complete -> [StateChanged: Closed]

Example of usage

rdpStream.on(RDPStream.Event.Response, (data) => console.log('Response event - Data:', data));

rdpStream.on(RDPStream.Event.Update, (data) => console.log('Update event - Data:', data));

rdpStream.on(RDPStream.Event.Ack, (data) => console.log('Ack event - Data:', data));

rdpStream.on(RDPStream.Event.Complete, rdpStream => console.log('Complete event'));

rdpStream.on(RDPStream.Event.StateChanged, (rdpStream, state) => console.log('RDPStream state changed:', state));

rdpStream.on(RDPStream.Event.Error, (err) => console.log('Error event:', err));