@gdyfe/elcps-msg
v0.1.2
Published
ELCPS's Message framework
Downloads
5
Readme
ELCPS-MSG
ELCPS's Message framework
Install
NPM(Recommended)
sudo npm install @gdyfe/elcps-msg --save
sudo yarn add @gdyfe/elcps-msg
Browser
Coming soon
Usage
Initialize
const websocketAddress = 'ws://xxx.xxx.xxx.xxx:xxxx'
const msgHandler = new LcpsMsg(websocketAddress, instanceId, msgCallback, reconnectSuccessCallback)
Send
Method: LcpsMsg.Send(msg: TMsg): void
type TMsg = {
server: string
data: {
cmd: string
data?: any
}
} | string
Example:
const res = await msgHandler.Send(msg)
Close
Method: LcpsMsg.Close(): void