Hmq is a Hyperbee based rpc. A node using hmq can be controller by adding one or more Hyperbee controllers.
const { Hmq } = require('hmq')
const ram = require('random-access-memory')
const controller = process.argv[2].split(',')
const callback = (data) => {
if(data.key === "say-hi"){
console.log(data.controller, "says hi!")
}
}
const rpc = new Hmq(ram, {callback : callback})
await rpc.init()
await rpc.add(controller)
const { HmqController } = require('hmq')
const controller = new HmqController()
await controller.init()
console.log(controller.core.key.toString('hex'))
setInterval(async () => await controller.send('say-hi'), 2000)
Setup controllers and start watching.
Add new controller by Hypercore public key.
Event emmited when new controller entry found.
Event emmited when new controller added.