Class: MetadataProvider

lightstreamer-adapter/metadataprovider~ MetadataProvider

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:
  • 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 response argument is a MetadataResponse object and one of its methods, error or success, must be called in order to reply to the request bound to the event.
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>, 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>, 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>, 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
With reference to the features qualified as optional, to know what features are enabled by your license, please see the License tab of the Monitoring Dashboard (by default, available at /dashboard).
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 adapter
params Object <optional>
optional parameters used by the default request handlers. By default
  • maxBandwidth: 0.0
  • notifyTables: false
  • minSourceFreq: 0.0
  • distinctSnapLen: 0
  • itemAllowedModes: {raw: true, merge: true, distinct: true, command: true}
  • userAllowedModes: {raw: true, merge: true, distinct: true, command: true}
  • allowedMaxItemFreq: 0.0
  • allowedBufferSize: 0

Method Summary

getStream
Returns the configured stream.

Method Detail

<inner> getStream

Returns the configured stream.
Returns:
Object the stream