16 lines
322 B
JavaScript
16 lines
322 B
JavaScript
|
const { Bonjour } = require('../dist')
|
||
|
|
||
|
const service = new Bonjour()
|
||
|
|
||
|
service.publish({ name: 'My Web Server', type: 'http', port: 3000 })
|
||
|
|
||
|
const browser = service.find({ type: 'http' })
|
||
|
|
||
|
browser.on('up', (service) => {
|
||
|
console.log('up', service)
|
||
|
})
|
||
|
|
||
|
browser.on('down', (service) => {
|
||
|
console.log('down', service)
|
||
|
})
|