Class: DataProvider

lightstreamer-adapter/dataprovider~ DataProvider

new DataProvider

Data provider constructor.
The created object allows you to interact with Lightstreamer Server through the Adapter Remoting Infrastructure protocol as a Remote Data Adapter. See the ARI Protocol documentation for details on the request and response messages.
This object extends the EventEmitter object and emits the following events:
  • init: function(request, response) {}
    Here, the request object is an associative array with the following content: {parameters: {<name 1>: <value 1> ... <name n>: <value n>}}
  • subscribe: function(itemName, response) {}
  • unsubscribe: function(itemName, response) {}
The response argument is a DataResponse object and one of its methods, error or success, must be called in order to reply to the request bound to the event.
Parameters:
Name Type Argument Description
reqRespStream Stream the request/reply stream channel to the remote LS proxy adapter
notifyStream Stream the asynchronous stream channel to the remote LS proxy adapter
isSnapshotAvailable Function <optional>
optional callback that receives an itemName as argument and must return a boolean value asserting if the item supports snapshot. The default value is function(itemName) {return false;}

Method Summary

clearSnapshot
Sends a clear snapshot message for a particular item to the remote LS proxy.
endOfSnapshot
Sends an end of snapshot message for a particular item to the remote LS proxy.
failure
Sends a failure message to the remote LS proxy.
getNotifyStream
Returns the configured notify stream.
getReqRespStream
Returns the configured request/reply stream.
update
Sends an update for a particular item to the remote LS proxy.

Method Detail

<inner> clearSnapshot

Sends a clear snapshot message for a particular item to the remote LS proxy.
Parameters:
Name Type Description
itemName String the item name

<inner> endOfSnapshot

Sends an end of snapshot message for a particular item to the remote LS proxy.
Parameters:
Name Type Description
itemName String the item name

<inner> failure

Sends a failure message to the remote LS proxy.
Parameters:
Name Type Description
exception String the exception message

<inner> getNotifyStream

Returns the configured notify stream.
Returns:
Object the stream

<inner> getReqRespStream

Returns the configured request/reply stream.
Returns:
Object the stream

<inner> update

Sends an update for a particular item to the remote LS proxy.
Parameters:
Name Type Description
itemName String the item name
isSnapshot Boolean is it a snapshot?
data Object an associative array of strings that represents the data to be published