
Bonjour Service
Description
Bonjour Service to advertise and browse for Services, this is a simple service that can be used to advertise and browse for services using bonjour.
const { default: Bonjour } = require("bonjour-service");
const bonjour = new Bonjour();
const id = `talk-bonjour-${Math.random().toString().slice(2)}`;
bonjour.publish({ name: id, type: "http", port: 3000 });
setInterval(() => {
// browse for all http services
bonjour.find({ type: "http" }, (service) => {
if (service.name === id) return;
console.log(`Found an HTTP server: ${service.host} ${service.referer.address}`)
});
}, 10);
// advertise an HTTP server on port 3000