0.1.2 • Published 5 years ago
@gdyfe/elcps-msg v0.1.2
ELCPS-MSG
ELCPS's Message framework
Install
NPM(Recommended)
sudo npm install @gdyfe/elcps-msg --save
sudo yarn add @gdyfe/elcps-msgBrowser
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
}
} | stringExample:
const res = await msgHandler.Send(msg)Close
Method: LcpsMsg.Close(): void
0.1.2
5 years ago