Open miqmago opened 6 years ago
The current implementation announces each service record on a fixed schedule, but doesn't respond at all to incoming query packets. Rather than alter the schedule to produce unsolicited announcements more regularly, could it work for you to add handlers in registry.js
that responded to query events? The RFC describes the approach. Responding to incoming queries would likely reduce latency and increase reliability of service discovery in your setting without increasing traffic caused by unsolicited announcements.
I would like to have a raspberry pi with a service announced in a continuous way, in that way an app could detect the service and start operating with it.
Digging inside
registry.js
I've seen that the delay is autocalculated with fixed constants:REANNOUNCE_FACTOR
andREANNOUNCE_MAX_MS
(https://github.com/watson/bonjour/blob/master/lib/registry.js#L147)I suggest to make it configurable via publish options. Does it make sense?
I think I could implement this feature and I'm open for pull requests, are they welcome?
My proposal would be to pass those parameters via
publish
opts and then fetch them insideregistry.js
.Something like this: