38 lines
890 B
JavaScript
38 lines
890 B
JavaScript
import { Socket } from '../src'
|
|
|
|
;
|
|
(async () => {
|
|
|
|
class Test extends Socket {
|
|
constructor(opts) {
|
|
super(opts)
|
|
}
|
|
|
|
// async _packetProcess(packet) {
|
|
// console.log('packet being processed at socket', packet)
|
|
// if (packet.cmd) return await this[packet.cmd](packet.data,packet.name)
|
|
// return {error: 'no command in packet', packet: packet }
|
|
// }
|
|
//
|
|
// async doit(data,name) {
|
|
// return new Promise(resolve => {
|
|
// let res = {}
|
|
// console.log('data sent to doit = ', data)
|
|
// res.status ='success'
|
|
// res.name = name
|
|
// res.cmd = 'reply'
|
|
// res.data = data
|
|
// resolve(res)
|
|
// })
|
|
// }
|
|
|
|
}
|
|
|
|
// let test = new Test()
|
|
let test = new Test({port:8090})
|
|
console.log(await test.create())
|
|
|
|
})().catch(err => {
|
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
|
})
|