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.[methodName]
<Function>
Keys with the arbitrary names that will be used as the remote method names.connection
<Connection>
...args
<any>
callback
<Function>
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.connection
<Connection>
...args
<any>
version
<string>
If a version is not provided either here or inname
,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)¶
connection
<Connection>
interfaceName
<string>
methodName
<string>
args
<Array>
callback
<Function>
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)¶
connection
<Connection>
interfaceName
<string>
eventName
<string>
args
<Array>
This method is called when handling incoming 'event'
message.
jstp.createAppsIndex(applications)¶
applications
<Application[]>
- Returns:
<Map>
Created index.
Create an index of applications from an array.