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>} }
  • 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>, device: {mpnPlatformType: <MPN platform type>, applicationId: <application ID>, deviceToken: <device token>}}
  • 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>,
    • if device.mpnPlatformType is "A", the subscription is for APNS and is composed of these additional data:
      sound: <sound name>, badge: <icon badge>, localizedActionKey: <localized action key>, launchImage: <launch image name>, format: <notification text format>, localizedFormatKey: <localized text format key>, localizedFormatArguments: [<localized text format argument>, ...], customData: {<custom data key>: <custom data value>, ...}}}
    • if device.mpnPlatformType is "G", the subscription is for GCM and is composed of these additional data:
      collapseKey: <collapse key>, data: {<data key>: <data value>, ...}, delayWhileIdle: <delay while idle flag>, timeToLive: <time to live value>}}
  • notifyMpnDeviceTokenChange: {userName: <username>, device: {mpnPlatformType: <MPN platform type>, applicationId: <application ID>, deviceToken: <device token>}, newDeviceToken: <new device token>}
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
  • 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)
  • 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