Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Latest commit

 

History

History
164 lines (97 loc) · 4.01 KB

actor.md

File metadata and controls

164 lines (97 loc) · 4.01 KB

sugo-actor@6.0.1

Actor component of SUGOS.

Functions

sugoActor(config) -> SugoActor

Create an actor instance. Just an alias of new SugoActor(config)

Param Type Description
config Object Sugo caller configuration

Example:

co(function * () {
  let actor = sugoActor({
    key: 'my-actor-01',
    modules: {
    }
  })
  yield actor.connect()
}).catch((err) => console.error(err))

SugoActor Class

Extends:

  • SugoClient

new SugoActor(url, config)

Constructor of SugoActor class

Param Type Description
url string Cloud server url
config object Configurations
config.key string Key of actor
config.auth object Auth object
config.modules object.<String, SugoActorModule> Modules to load.
config.path string Socket.IO option.

actor.connect() -> Promise

Connect to hub. By call this, actor share specification of the modules to hub so that callers can access them.

actor.disconnect() -> Promise

Disconnect from the hub

actor.perform(data) -> Promise

Handle perform event

Param Type Description
data object

actor.load(moduleName, module) -> Promise

Load a module

Param Type Description
moduleName string Name of module
module Object Module to load

actor.loadSub(moduleName, subModules) -> Promise

Load sub modules

Param Type Description
moduleName string
subModules Object

actor.unload(moduleName) -> Promise

Unload a module

Param Type Description
moduleName string Name of module

actor.unloadSub(moduleName, subModuleNames) -> *

Unload sub module

Param Type Description
moduleName string Name of module
subModuleNames Array.<string> Name of sub modules

actor.assertConnection()

Assert if the connected to hub

actor.urlFromConfig()

actor.parseActorUrl()

Parse actor url