new MetadataProvider
Metadata provider constructor.
The created object allows you to interact with Lightstreamer Server through the Adapter Remoting Infrastructure protocol as a Remote Metadata 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 request object is an associative array containing different data according to the specific request:
When the handler for some event is not supplied, a default response is provided; some default responses can be configured with the optional constructor parameters. The getItems and getSchema events are handler in a way similar to the LiteralBasedProvider supplied with the Java in-process Adapter SDK.
To resume the default behavior:
The created object allows you to interact with Lightstreamer Server through the Adapter Remoting Infrastructure protocol as a Remote Metadata 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) {}
- getItemData: function(request, response) {}
- getUserItemData: function(request, response) {}
- getSchema: function(request, response) {}
- getItems: function(request, response) {}
- notifyUser: function(request, response) {}
- notifyUserAuth: function(request, response) {}
- notifyUserMessage: function(request, response) {}
- notifyNewSession: function(request, response) {}
- notifySessionClose: function(request, response) {}
- notifyNewTables: function(request, response) {}
- notifyTablesClose: function(request, response) {}
- notifyMpnDeviceAccess: function(request, response) {}
- notifyMpnSubscriptionActivation: function(request, response) {}
- notifyMpnDeviceTokenChange: function(request, response) {}
The request object is an associative array containing different data according to the specific request:
- init: {parameters: {<name 1>: <value 1> ... <name n>: <value n>}}
- getItemData: {itemNames: [<item name 1> ... <item name n>]}
- getUserItemData: {userName: <username>, itemNames: [<item name 1> ... <item name n>]}
- getSchema: {userName: <username>, groupName: <group name>, schemaName: <schema name>, sessionId: <session id>}
- getItems: {userName: <username>, groupName: <group name>, sessionId: <session id>}
- notifyUser: {userName: <username>, userPassword: <password>, headers: {<name 1>: <value 1> ... <name n>: <value n>} }
- notifyUserAuth: {userName: <username>, userPassword: <password>, clientPrincipal: <client principal>,
headers: {<name 1>: <value 1> ... <name n>: <value n>} }
NOTE: clientPrincipal is related with TLS/SSL connections, which is an optional feature, available depending on Edition and License Type - notifyUserMessage: {userName: <username>, sessionId: <session id>, userMessage: <message>}
- notifyNewSession: {userName: <username>, sessionId: <session id>, contextProperties: {<name 1>: <val 1> ... <name n>: <value n>}}
- notifySessionClose: {sessionId: <session id>}
- notifyNewTables: {userName: <username>, sessionId: <session id>, tableInfos: [{winIndex: <win index>, pubModes: <publish mode>, groupName: <group name>, dataAdapter: <data adapter>, schemaName: <schema name>, firstItemIndex: <first index>, lastItemIndex: <last index>, selector: <selector>}, ...]}
- notifyTablesClose: {sessionId: <session id>, tableInfos: [{winIndex: <win index>, pubModes: <publish mode>, groupName: <group name>, dataAdapter: <data adapter>, schemaName: <schema name>, firstItemIndex: <first index>, lastItemIndex: <last index>, selector: <selector>}, ...]}
- notifyMpnDeviceAccess: {userName: <username>, sessionId: <session id>,
device: {mpnPlatformType: <MPN platform type>, applicationId: <application ID>, deviceToken: <device token>}}
NOTE: Push Notifications is an optional feature, available depending on Edition and License Type - notifyMpnSubscriptionActivation: {userName: <username>, sessionId: <session id>,
tableInfo: {winIndex: <win index>, pubModes: <publish mode>, groupName: <group name>, dataAdapter: <data adapter>,
schemaName: <schema name>, firstItemIndex: <first index>, lastItemIndex: <last index>, selector: <selector>},
mpnSubscription: {device: {mpnPlatformType: <MPN platform type>, applicationId: <application ID>, deviceToken: <device token>},
trigger: <trigger expression>, notificationFormat: <notification format descriptor>}
The structure of the format descriptor depends on the platform type and it is represented as a json string;
NOTE: Push Notifications is an optional feature, available depending on Edition and License Type - notifyMpnDeviceTokenChange: {userName: <username>, sessionId: <session id>,
device: {mpnPlatformType: <MPN platform type>, applicationId: <application ID>, deviceToken: <device token>},
newDeviceToken: <new device token>}
NOTE: Push Notifications is an optional feature, available depending on Edition and License Type
When the handler for some event is not supplied, a default response is provided; some default responses can be configured with the optional constructor parameters. The getItems and getSchema events are handler in a way similar to the LiteralBasedProvider supplied with the Java in-process Adapter SDK.
To resume the default behavior:
- init: does nothing
- getItemData: for each item returns the configured distinctSnapLen, minSourceFreq, and itemAllowedModes
- getUserItemData: for each item returns the configured allowedBufferSize, allowedMaxItemFreq, and userAllowedModes;
NOTE: A further global frequency limit could also be imposed by the Server, depending on Edition and License Type. - getSchema: reads the supplied schemaName as a space-separated list of field names and returns an array of such field names
- getItems: reads the supplied groupName as a space-separated list of item names and returns an array of such item names
- notifyUser: returns the configured maxBandwidth and notifyTables (hence accepts the user);
NOTE: Bandwidth Control is an optional feature, available depending on Edition and License Type - notifyUserAuth: returns the configured maxBandwidth and notifyTables (hence accepts the user)
- notifyUserMessage: does nothing (hence accepts but ignores the message)
- notifyNewSession: does nothing (hence accepts the session)
- notifySessionClose: does nothing
- notifyNewTables: does nothing (hence accepts the tables)
- notifyTablesClose: does nothing
- notifyMpnDeviceAccess: does nothing (hence allows the access)
- notifyMpnSubscriptionActivation: does nothing (hence accepts the activation)
- notifyMpnDeviceTokenChange: does nothing (hence accepts the change)
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
stream |
Stream | the stream channel to the remote LS Proxy Metadata Adapter. In case of interruption, the 'error' event on the stream may report interruption cause details. | |
params |
Object |
<optional> |
optional parameters used by the default request handlers. By default
|
credentials |
Object |
<optional> |
optional credentials to be submitted to the remote LS Proxy Metadata 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 stream to prevent LS Proxy Metadata 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
- getStream
- Returns the configured stream.
Method Detail
-
<inner> getStream
-
Returns the configured stream.
Returns:
Object the stream