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