import { Socket } from '../src' ; (async () => { class Test extends Socket { constructor(opts) { super(opts) } async _packetProcess(packet) { console.log('packet being processed at socket') 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 = 'this would be response data from socket doit function' resolve(res) }) } } // let test = new Test() let test = new Test({path:true, conPacket:{onconnect:'this is a packet sent to consumer as soon as it connects'}}) await test.create() let count = 0 setInterval( () => { count++ test.push({name:'pushed', count:count, status:'some pushed data'}) },10000) })().catch(err => { console.error('FATAL: UNABLE TO START SYSTEM!\n',err) })