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:
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) {}
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
reqRespStream |
Stream | the request/reply stream channel to the remote LS Proxy Data Adapter. In case of interruption, the 'error' event on the stream may report interruption cause details. | |
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. |
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.
- declareFieldDiffOrder
- Sends information about "diff" algorithms for some or all fields of a particular item.
- 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> declareFieldDiffOrder
-
Sends information about "diff" algorithms for some or all fields of a particular item. The algorithms suitable for each fields should be expressed as an array of string literals representing the actual algorithms in the desired order. Omitted fields or null arrays will add no information. On the other hand, an empty array can be supplied to mean that no "diff" algorithm is admitted for a field.
Parameters:
Name Type Description itemName
String the item name algorithmsMap
Object an associative array of algorithm lists, in turn expressed as a (possibly empty) array of string literals. Supported literals are: - "JSONPATCH": Computes the difference between two values that are valid JSON string representations in JSON Patch format.
- "DIFF_MATCH_PATCH": Computes the difference between two values with Google's "diff-match-patch" algorithm (the result is then serialized with the custom "TLCP-diff" format). This algorithm applies to any strings, only provided that their UTF-16 representation doesn't contain surrogate pairs.
-
<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