import { Socket } from '../src' const USOCKET = __dirname + '/sample.sock' console.log(USOCKET) ; (async () => { class Test { constructor(opts={}) { this.socket = new Socket(USOCKET) this.uspp = opts.uspp || 'processPacket' } async processPacket(packet) { console.log('packet being processed') console.dir(packet) return await this[packet.cmd](packet.data,packet.name) } async doit(data,name) { let res = {} console.log('data:', data) res.status ='success' res.name = name res.data = 'this would be response from device' return(res) } init() { this.socket.create(this)} } let test = new Test() await test.init() })().catch(err => { console.error('FATAL: UNABLE TO START SYSTEM!\n',err) })