Class: MetadataResponse

lightstreamer-adapter/metadataprovider~ MetadataResponse

Private constructor arguments: {Stream} stream the stream channel to the remote LS server adapter {Object} message the request data {Function} writeSuccess callback to the serialization function for a successful response {Function} writeError callback to the serialization function for an error response

new MetadataResponse

MetadataResponse constructor. An instance of this class is passed as argument to an event listener, and must be used to respond to the remote adapter request, using the success method or the error method.

Method Summary

error
Sends an error response.
success
Sends a successful response.

Method Detail

<inner> error

Sends an error response. The optional exception type parameter that can be used to issue a proper type of exception depends on the event handled as described in the following table:
  • init: "metadata"
  • getItemData: none
  • getUserItemData: none
  • getSchema: "items" or "schema"
  • getItems: "items"
  • notifyUser: "access" or "credits"
  • notifyUserAuth: "access" or "credits"
  • notifyUserMessage: "credits" or "notification"
  • notifyNewSession: "credits" or "conflictingSession" or "notification"
  • notifySessionClose: "notification"
  • notifyNewTables: "credits" or "notification"
  • notifyTablesClose: "notification"
  • notifyMpnDeviceAccess: "credits" or "notification"
  • notifyMpnSubscriptionActivation: "credits" or "notification"
  • notifyMpnDeviceTokenChange: "credits" or "notification"
Parameters:
Name Type Argument Description
exceptionMessage String exception message
exceptionType String <optional>
exception type
exceptionData Object <optional>
extra information required by the exception, to be supplied as an associative array. Depending on the exception type; the following cases are possible:
  • "credits": extra information is mandatory and should have the form: {clientCode: <client code>, clientMessage: <client message>}.
  • "conflictingSession": extra information is mandatory and should have the form: {clientCode: <client code>, clientMessage: <client message>, conflictingSessionId: <session id>}.
  • Others or not specified: no extra information needed.
Where:
  • clientCode is an error code that can be used to distinguish the kind of problem. It must be a negative integer, or zero to mean an unspecified problem.
  • clientMessage is a detail message to be forwarded to the Client. The message should be in simple ASCII, otherwise it might be altered in order to be sent to the client; multiline text is also not allowed.
  • conflictingSessionId is the ID of a Session that can be closed in order to eliminate the reported problem.

<inner> success

Sends a successful response. Parameters that can be used depends on the event handled as described in the following table:
  • init: success()
  • getItemData: success([{distinctSnapLen: <distinct snapshot length>, minSourceFreq: <min source frequency>, allowedModes: {raw: <raw allowed>, merge: <merge allowed>, distinct: <distinct allowed>, command: <command allowed>}}, ...])
  • getUserItemData: success([{allowedBufferSize: <allowed buffer size>, allowedMaxItemFreq: <allowed max item frequency>}, allowedModes: {raw: <raw allowed for user>, merge: <merge allowed for user>, distinct: <distinct allowed for user>, command: <command allowed for user>}}, ...])
  • getSchema: success([<field 1>, <field 2>, ...])
  • getItems: success([<item 1>, <item 2>, ...])
  • notifyUser: success(<allowed max bandwidth>, <wants table notifications>)
  • notifyUserAuth: success(<allowed max bandwidth>, <wants table notifications>)
  • notifyUserMessage: success()
  • notifyNewSession: success()
  • notifySessionClose: success()
  • notifyNewTables: success()
  • notifyTablesClose: success()
  • notifyMpnDeviceAccess: success()
  • notifyMpnSubscriptionActivation: success()
  • notifyMpnDeviceTokenChange: success()