import Consumer from '../src/consumer' // const client1= new Consumer({name:'example-consumer1' }) const client= new Consumer({path:true, name:'example-consumer' }) let packet = {name: 'client', cmd:'doit', data:'data sent by client'} // 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}`) } client.registerPacketProcessor(process) ; (async () => { // await Promise.all([client1.connect(),client2.connect()]) await client.connect() console.log('sending packet ', packet) console.log('=========\n',await client.send(packet)) // client.end() })().catch(err => { console.error('FATAL: UNABLE TO START SYSTEM!\n',err) })