Constructor
new RktPlug(callback, url)
核心接口服务通信对象
Parameters:
Name | Type | Default | Description |
---|---|---|---|
callback | callback | 意外断开通知回调 | |
url | string | ws://127.0.0.1:3080 | 接口服务地址 默认 ws://127.0.0.1:3080 |
- Source
Methods
(async) asyncSend(code, obj) → {Promise}
接口协议发送
Parameters:
Name | Type | Description |
---|---|---|
code | number | 接口命令码 |
obj | object | 接口参数对象 |
- Source
Returns:
- Type:
- Promise
bindEvent(code, callback)
绑定特殊指令事件回调
Parameters:
Name | Type | Description |
---|---|---|
code | number | 特殊接口命令码 |
callback | callback | 事件回调 |
- Source
close()
关闭连接释放资源
- Source
isLogin() → {boolean}
判断是否已登录
- Source
Returns:
- Type:
- boolean
(async) login(user, pass) → {Promise}
登录接口服务
Parameters:
Name | Type | Default | Description |
---|---|---|---|
user | string | public | 如用户未修改则默认为 "public" |
pass | string | Rokato | 如用户未修改则默认为 "Rokato" |
- Source
Returns:
- Type:
- Promise
(async) version() → {Promise}
获取当前已登录服务的版本信息
- Source
Returns:
err/msg + ver/version/build
- Type:
- Promise
(static) execUrl(port)
获取启动插件服务自定义协议地址
Parameters:
Name | Type | Default | Description |
---|---|---|---|
port | number | 0 | 当端口号>0时则使用更改端口号方式重新启动 |
- Source