bonjour
bonjour copied to clipboard
Failed to resolve service
I'm trying to create a bonjour service which advertises a specific name, in order to make my node server discoverable from other devices
console.log("Starting bonjour service...");
var bonjourService = bonjour.publish({ name: 'agendaserver', type: 'http', port: 8080 });
bonjourService.start();
bonjourService.on('up', function () {
console.log("Started bonjour service on " + bonjourService.fqdn + ":" + bonjourService.port);
// => Started bonjour service on agendaserver._http._tcp.local:8080
console.log("published = " + bonjourService.published) // => true
});
When I try to discover the service with avahi-browse -rk _http._tcp
on the same machine, I get the following error:
Failed to resolve service 'agendaserver' of type '_http._tcp' in domain 'local': DNS failure: NXDOMAIN
What am I doing wrong?
Do I need to configure the underlying multicast-dns server?
/**
* Created by crazy on 17-4-27.
*/
var bonjourService = require('bonjour')()
console.log("Starting bonjour service...");
var bonjourService = bonjourService.publish({ name: 'agendaserver', type: 'http', port: 8080 });
bonjourService.start();
bonjourService.on('up', function () {
console.log("Started bonjour service on " + bonjourService.fqdn + ":" + bonjourService.port);
// => Started bonjour service on agendaserver._http._tcp.local:8080
console.log("published = " + bonjourService.published) // => true
});
Today I use this lib ,and read source code.so I test Your code in Linux Mint 18.1.
Starting bonjour service...
Started bonjour service on agendaserver._http._tcp.local:8080
published = true
Test OK.What system that You use
But In fact I also get same result by "avahi-discover"
Error: org.freedesktop.Avahi.DNSNXDOMAIN: DNS failure: NXDOMAIN
@watson Did you test it OK?
This is My Second Day Try to solve it . I use avahi to publish my service,that OK. bu use bonjour this lib to publish my service seems ok,but could not get IpAddress.It seem lost enps0 interface. @Cir0X Did you solve it