Caller component of SUGOS.
- Functions
SugoCaller
ClassActorAccessBundle
ClassActorAccessModule
Class
Create a caller instance. Just an alias of new SugoCaller(config)
Param | Type | Description |
---|---|---|
config | Object | Sugo caller configuration |
Example:
co(function * () {
let caller = sugoCaller({})
let actor01 = yield caller.connect('my-actor-01')
let foo = actor01.get('foo') // Get a module of actor
yield foo.sayYeah() // Call the remote function
}).catch((err) => console.error(err))
Hub client for caller side. When you connect to remote actor with a caller, it receives specification of the actor and dynamically define function to kick actor side function. With this way you can magically call functions declared on remote as if they were here.
Extends:
SugoClient
Constructor of SugoCaller class
Param | Type | Description |
---|---|---|
config | Object | Caller configuration |
config.protocol | string | Protocol to use ( "http" or "https" ) |
config.host | string | Hub host name. ( eg: "localhost:3000" ) |
config.pathname | string | Hub URL path name ( eg: "/callers" ) |
config.auth | Object | Auth data for hub |
Connect to actor
Param | Type | Description |
---|---|---|
key | string | Key of actor |
options | Object | Optional settings |
options.messages | Object | Connect messages |
Disconnect from cloud server
Param | Type | Description |
---|---|---|
key | string | Key of actor to connect |
options | Object | Optional settings |
options.messages | Object | Disconnect messages |
Bundle for actor access. This class provides access for loaded modules on actor.
Constructor of ActorAccessBundle class
Param | Type | Description |
---|---|---|
specs | Object | Actor module specs |
Get a module
Param | Type | Description |
---|---|---|
moduleName | string | Name of module |
options | Object | Optional settings |
Check if module exists
Param | Type | Description |
---|---|---|
moduleName | string | Name of module |
Set module
Param | Type | Description |
---|---|---|
moduleName | string | Name of module |
module | ActorAccessModule | Module to set |
options | Object | Optional settings |
Delete module
Param | Type | Description |
---|---|---|
moduleName | string | Name of module |
Get names of modules
Loaded module for an actor. This class provides pseudo interfaces for remote actor module
Constructor of ActorAccessModule class
Param | Type | Description |
---|---|---|
methods | Object | Actor specifications for module methods |
connection | Object | Actor connections |