import Consumer from '../src/consumer' const client1= new Consumer({np:true,name:'example-consumer1' }) const client2 = new Consumer({np:true,name:'example-consumer2'}) let packet1 = {name: 'client1', cmd:'doit', data:'data sent by client1'} let packet2 = {name: 'client2', cmd:'doit', data:'data sent by client2'} // This is your client handler object waiting on a message to do something const process = function (packet) { console.log(`Packet from ${packet.name} Processed by Socket: ${packet.status}`) } // client1.registerPacketProcessor(process) // // client2._packetProcess = process ; (async () => { // await Promise.all([client1.connect(),client2.connect()]) await client1.connect() console.log('=========\n',await client1.send(packet1)) // client1.send(packet1) // client2.send(packet2) // client1.end() // client2.end() })().catch(err => { console.error('FATAL: UNABLE TO START SYSTEM!\n',err) })