Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bonjour can find services that it created itself, but nothing else can #14

Open
MarshallOfSound opened this issue May 18, 2016 · 13 comments

Comments

@MarshallOfSound
Copy link

Running the following in my app

const service = bonjour.publish({
  type: 'GPMDP',
  name: os.hostname(),
  port: 5672,
  txt: {
    API_VERSION,
  },
});

service.start();

The up event is fired for service but when I attempt to find the published service with this chrome app
https://chrome.google.com/webstore/detail/mdns-browser/kipighjpklofchgbdgclfaoccdlghidp

It is not there. Is there some configuration step I am missing, or is there a trick to getting this to run on a device that already has Apple Bonjour running?

@watson
Copy link
Owner

watson commented May 19, 2016

@MarshallOfSound It might be related to which interface it tries to bind to. It should bind to all network interfaces, but maybe it doesn't. Do you mind showing me your os.networkInterfaces() configuration?

@MarshallOfSound
Copy link
Author

You can take a look, there are a few interfaces there though 😄

{
  "VirtualBox Host-Only Network #2":[
    {
      "address":"2620:9b::1922:5b34",
      "netmask":"ffff:ffff:ffff:ffff::",
      "family":"IPv6",
      "mac":"0a:00:27:00:00:00",
      "scopeid":0,
      "internal":false
    },
    {
      "address":"fe80::5c1a:317d:78e0:8d3c",
      "netmask":"ffff:ffff:ffff:ffff::",
      "family":"IPv6",
      "mac":"0a:00:27:00:00:00",
      "scopeid":4,
      "internal":false
    },
    {
      "address":"169.254.141.60",
      "netmask":"255.255.0.0",
      "family":"IPv4",
      "mac":"0a:00:27:00:00:00",
      "internal":false
    }
  ],
  "Ethernet":[
    {
      "address":"2001:388:608c:6cb4:29b4:1aad:ca61:f3fa",
      "netmask":"ffff:ffff:ffff:ffff::",
      "family":"IPv6",
      "mac":"fc:aa:14:28:ac:a3",
      "scopeid":0,
      "internal":false
    },
    {
      "address":"2001:388:608c:6cb4:8c17:17c8:9aa3:e543",
      "netmask":"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
      "family":"IPv6",
      "mac":"fc:aa:14:28:ac:a3",
      "scopeid":0,
      "internal":false
    },
    {
      "address":"fe80::29b4:1aad:ca61:f3fa",
      "netmask":"ffff:ffff:ffff:ffff::",
      "family":"IPv6",
      "mac":"fc:aa:14:28:ac:a3",
      "scopeid":9,
      "internal":false
    },
    {
      "address":"118.138.193.83",
      "netmask":"255.255.252.0",
      "family":"IPv4",
      "mac":"fc:aa:14:28:ac:a3",
      "internal":false
    }
  ],
  "Loopback Pseudo-Interface 1":[
    {
      "address":"::1",
      "netmask":"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
      "family":"IPv6",
      "mac":"00:00:00:00:00:00",
      "scopeid":0,
      "internal":true
    },
    {
      "address":"127.0.0.1",
      "netmask":"255.0.0.0",
      "family":"IPv4",
      "mac":"00:00:00:00:00:00",
      "internal":true
    }
  ],
  "Teredo Tunneling Pseudo-Interface":[
    {
      "address":"2001:0:9d38:90d7:2466:1cd1:8975:3eac",
      "netmask":"ffff:ffff:ffff:ffff::",
      "family":"IPv6",
      "mac":"00:00:00:00:00:00",
      "scopeid":0,
      "internal":false
    },
    {
      "address":"fe80::2466:1cd1:8975:3eac",
      "netmask":"ffff:ffff:ffff:ffff::",
      "family":"IPv6",
      "mac":"00:00:00:00:00:00",
      "scopeid":24,
      "internal":false
    }
  ]
}

@MarshallOfSound
Copy link
Author

@watson It appears to be due to bonjour not responding to a _services._dns-sd._udp.local QUERY

https://developer.apple.com/library/mac/qa/qa1337/_index.html

@jostrander
Copy link

Seems to work fine for me @MarshallOfSound, try using an mDNS browser app on your phone to verify.

@watson
Copy link
Owner

watson commented May 20, 2016

@MarshallOfSound ah yes, that might also be it. I have a local fix for it that depends on something being fixed first in a dependency that I've been putting off for too long now. I'll see if I can get it fixed in the weekend. Thanks for letting me know about this 😃

@MarshallOfSound
Copy link
Author

@watson Is there any progress on this, is there anything I can do to help? 😸

@Keammoort
Copy link

Keammoort commented Jul 21, 2016

@watson is there any chance for this fix? I find this package to have the best api, but I cannot discover services (that were published on PC using bonjour) on an Android phone using NSD. However the services registered by Android phone are visible on PC.

@haddadnidal
Copy link

haddadnidal commented Jul 30, 2016

hi guys, i published a service and detection from an android app was a success but not frm the chrome mdns browser ? any fix guys ?

@gabrielstuff
Copy link

looks like a dead end @watson do you think you are going to provide the relevant fix ?

Thanks !

@black-snow
Copy link

black-snow commented Dec 13, 2016

+500 on this, can't detect a service on my mac (dns-sd -B) that I've published on my windows machine.
Works fine when publishing via dns-sd. Also I can see the announcement on the same machine but not on any other device.

/btw, opts.probe ain't seem to be documented

@MarshallOfSound have you found a fix? How have you worked around this? Are you using some other solution?

@watson Are you still maintaining this project? Would love to see a fix / contribute.

@faceless2
Copy link

faceless2 commented Sep 5, 2017

The service announcement in this example, and by default if not specified, uses "os.hostname()" as the host for the service. This must have ".local" at the end to work, but that's certainly not the case for some Linux installs - I would go so far as to say most Linux installs. Without this, the service is announced but isn't resolvable to a host.

On my setup here (a minimal Ubuntu install), this was fixed by changing the line in service.js from:

this.host = opts.host || os.hostname();

to something like:

var oshost = os.hostname();
if (oshost.indexOf(".") < 0) {
    oshost  += ".local";
}
this.host = opts.host || oshost;

No pull request as I'm not sure how this will work on different combinations of client and server OS, but it's fixed this issue for me with a Linux server and Mac client.

@VanTudor
Copy link

VanTudor commented Sep 21, 2020

Piggybacking on @faceless2's answer:
I had the same issue on Ubuntu running in a VM, although I was using HTTP.

Added the host parameter specifying the .local suffix. Something like:
bonjour.publish({ name: 'my_server', host: 'woopboop.local', type: 'http', port: 3000 })
instead of
bonjour.publish({ name: 'my_server', type: 'http', port: 3000 })

Pinging woopboop.local from my terminal worked after this.
Hope it helps.

@Vannevelj
Copy link

I went with https://github.com/agnat/node_mdns and that worked from the get-go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants