Skip to content

Application

Class: jstp.Application

Generic application class. You are free to substitute it with other class with the same interface that suits your needs.

Constructor: new Application(name, api[, eventHandlers[, version][, ssp]])

  • name <string> Application name that may contain version after '@' (e.g. app@1.0.0). Version in name is preferred over 'version' parameter.
  • api <Object>
    • [interfaceName] <Object> Keys with the arbitrary names that will be used as the remote interface names.
  • eventHandlers <Object>
    • [interfaceName] <Object> Keys with the arbitrary names that will be used as the remote interface names.
      • [eventName] <Function> Keys with the arbitrary names that will be used as the remote event names.
  • version <string> If a version is not provided either here or in name, 1.0.0 is used.
  • ssp <SessionStorageProvider> If provided, it is used to store sessions independently of other applications.

application.callMethod(connection, interfaceName, methodName, args, callback)

This method is called when handling incoming 'call' message.

application.getMethods(interfaceName)

  • interfaceName <string> Name of the interface to inspect.
  • Returns: <string[]> Array of method names of the interface.

This method is called when handling incoming 'inspect' message.

application.handleEvent(connection, interfaceName, eventName, args)

This method is called when handling incoming 'event' message.

jstp.createAppsIndex(applications)

Create an index of applications from an array.