cat-bookmarker/assets/node_modules/bonjour-service/examples/simple.js

16 lines
320 B
JavaScript
Raw Permalink Normal View History

2024-03-10 18:52:04 +00:00
const { Bonjour } = require('../dist')
const service = new Bonjour()
service.publish({ name: 'My Web Server', type: 'http', port: 3000 })
let browser = service.find({ type: 'http' })
browser.on('up', (service) => {
console.log('up', service)
})
browser.on('down', (service) => {
console.log('down', service)
})