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 Data Adapter.
notifyStream Stream the asynchronous stream channel to the remote LS Proxy Data 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;}
credentials Object <optional>
optional credentials to be submitted to the remote LS Proxy Data Adapter. The credentials are needed only if the Proxy Adapter is configured to require Remote Adapter authentication. If needed, the supplied object should contain both a "user" and a "password" field, in order for the credentials to be sent; otherwise, null can be specified.
keepaliveInterval Number <optional>
optional time in milliseconds between subsequent keepalive packets to be sent on the reply and notify streams to prevent LS Proxy Data Adapter and any intermediate nodes from closing the connection for inactivity; a value of 0 or negative means no keepalives; the default if not supplied is 10000 ms. However, if a stricter interval is requested by the Proxy Adapter on startup, it will be obeyed (with a safety minimum of 1 second). This should ensure that the Proxy Adapter activity checks will always succeed, but for some old versions of the Proxy Adapter. The keepalives can also allow for prompt detection of connection issues.

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