Delivery.RDPStream.Event
RDPStream.Event provides a set of events described below that can be emitted by the RDPStream.
RDPStream.Event.Response
Response events are emitted when all the data from the requested universe items has been received.
RDPStreamResponseCb callback parameters
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| data | The full data of requested universe items (see RDPResponseResponse below). | object | - | - |
| stream | The RDPStream object that emitted the event (see RDPStream). | object | - | - |
RDPResponseResponse properties
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| streamID | The client request identifier that will be returned in each response. | string | No | - |
| type | The response type (possible values are 'Response', 'Update', 'Ack', 'Alarm'). | string | No | - |
| headers | The additional attributes of the data table, such as, Name, Type, Display Pattern, and Alignment. | any[] | Yes | - |
| data | Domain specific data defined by the back-end, but not suitable in fields. Normally presented as a two/three dimensional data table. | any[][] | Yes | - |
| fields | The client-requested fields (as field/value pairs). | object | Yes | - |
| name | The name of the client-requested universe. | string | Yes | - |
| messages | The actual responses | any[] | Yes | - |
RDPStream.Event.Update
Update events are emitted when fields of the requested instrument change. Update events only contain the fields and values that have changed. When the application receives an update it must update its internal representation of the instrument (if any) accordingly.
RDPStreamUpdateCb callback parameters
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| data | The updated fields with their new values (see RDPUpdateResponse below). | object | - | - |
| stream | The RDPStream object that emitted the event (see RDPStream). | object | - | - |
RDPUpdateResponse properties
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| streamID | The client request identifier that will be returned in each response. | string | No | - |
| type | The response type (possible values are 'Response', 'Update', 'Ack', 'Alarm'). | string | No | - |
| headers | The additional attributes of the data table, such as, Name, Type, Display Pattern, and Alignment. | any[] | Yes | - |
| data | Domain specific data defined by the back-end, but not suitable in fields. Normally presented as two/three dimensional data table. | any[][] | Yes | - |
| fields | The client-requested fields (as field/value pairs). | object | Yes | - |
| name | The name of the client-requested universe. | string | Yes | - |
| updateType | The type of the update message. | string | Yes | - |
| messages | The response bodies. | any[] | Yes | - |
RDPStream.Event.Ack
Ack events are emitted when the state of the stream changes.
RDPStreamAckCb callback parameters
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| data | The new status of the instrument (see RDPAckResponse below). | object | - | - |
| stream | The RDPStream object that emitted the event (see RDPStream). | object | - | - |
RDPAckResponse properties
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| streamID | The client request identifier that will be returned in each response. | string | Yes | - |
| type | The response type (possible values are 'Response', 'Update', 'Ack', 'Alarm'). | string | No | - |
| state | The new state of the stream (see RDPResponseState). | object | No | - |
RDPStream.Event.Alarm
Alarm events are emitted when the stream receives an alarm/notification message.
RDPStreamAlarmCb callback parameters
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| data | The notification message (see RDPAlarmResponse below). | object | - | - |
| stream | The RDPStream object that emitted the event (see RDPStream). | object | - | - |
RDPAlarmResponse properties
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| streamID | The client request identifier that will be returned in each response. | string | Yes | - |
| type | The response type (possible values are 'Response', 'Update', 'Ack', 'Alarm'). | string | No | - |
| data | Any data sent with an alarm message. | any | No | - |
RDPStream.Event.StateChanged
The StateChanged event is emitted when the RDPStream state is changed.
RDPStreamStateChangedCb callback parameters
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| stream | The RDPStream object that emitted the event (see RDPStream). | object | - | - |
| state | The new state of the RDPStream (see State). | enum | - | - |
RDPStream.Event.Complete
The Complete event is emitted once the requested instrument receives a Response event.
RDPStreamCompleteCb callback parameters
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| stream | The RDPStream object that emitted the event (see RDPStream). | object | - | - |
RDPStream.Event.Error
An Error event is emitted when an error message is received for the requested instrument.
RDPStreamErrorCb callback Parameters
| Value | Description | Data type | Optional | Default value |
|---|---|---|---|---|
| error | Error object received from the stream. | Error | - | - |
| stream | The RDPStream object that emitted the event (see RDPStream). | object | - | - |
Usage
The following example demonstrates how to attach event listeners on an RDP stream object.
import { Delivery } from '@lsegroup/data';
const stream = Delivery.RDPStream.Definition({
universe: 'RBH0',
parameters: { instrumentType: 'RIC' }
}).getStream();
stream.on(Delivery.RDPStream.Event.Response, (data) => console.log('Response event - Data:', data));
stream.on(Delivery.RDPStream.Event.Update, (data) => console.log('Update event - Data:', data));
stream.on(Delivery.RDPStream.Event.Ack, (data) => console.log('Ack event - Data:', data));
stream.on(Delivery.RDPStream.Event.Complete, rdpStream => console.log('Complete event'));
stream.on(Delivery.RDPStream.Event.StateChanged, (rdpStream, state) => console.log('RDPStream state changed:', state));
stream.on(Delivery.RDPStream.Event.Error, (err) => console.log('Error event:', err));
`