@gdyfe/elcps-rpc
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

ELCPS-RPC

ELCPS's RPC communication framework

Install

NPM(Recommended)

sudo npm install @gdyfe/elcps-rpc --save
sudo yarn add @gdyfe/elcps-rpc

Browser

Coming soon

Usage

Initialize

const websocketAddress = 'ws://xxx.xxx.xxx.xxx:xxxx'
const rpc = new LcpsRpc(websocketAddress)

Request

Method: LcpsRpc.Request(msg: TMsg): Promise<TResult>

type TMsg = {
  server: string
  data: {
    cmd: string
    data?: any
  }
}

type TResult = {
  code: string
  message: string
  data?: any
}

Example:

const res = await rpc.Request({
  server: instanceId,
  data: {
    cmd: 'setConfig',
    config: data
  }
})

data.cmd fields support many types: getConfig, setConfig

Close

Method: LcpsRpc.Close(): void

Readme

Keywords

Package Sidebar

Install

npm i @gdyfe/elcps-rpc

Weekly Downloads

0

Version

0.1.1

License

ISC

Unpacked Size

11.8 kB

Total Files

12

Last publish

Collaborators

  • whzcorcd
  • laev
  • shelter01