watson / bonjour

A Bonjour/Zeroconf protocol implementation in JavaScript
MIT License
627 stars 146 forks source link

Can't discover on different machines #16

Open mishoboss opened 8 years ago

mishoboss commented 8 years ago

Hi, I'm totally unable to discover the service published via this module when using different machines under the same local network:

Server on machine 1:

console.log('start');
var bonjour = require('bonjour')({multicast: true, ttl: 255});
var service = bonjour.publish({ name: 'My Web Server', type: 'http', port: 3000 })
service.start();

Client on machine 2:

console.log('start finder');
var bonjour = require('bonjour')({multicast: true, ttl: 255});
var service = bonjour.find({ type: 'http' }, function (service) {
    console.log('Found HTTP server:' + JSON.stringify(service))
});
service.start();

Note that when server and client run on the same machine, it works as expected. I'm not sure if this issue is due to implementation, or router configuration. My network consists from a MikroTik router and Ubiquiti UniFi Access point. Other ssdp works like a charm. Any ideas are welcome.

bus710 commented 7 years ago

Same here.

1. server side

I ran a command in my Ubuntu system.

sudo avahi-publish-service $HOSTNAME _http._tcp 3000 "test"

2. client side

I ran the snippet in my Windows 10 system.

var bonjour = require('bonjour')();

bonjour.find({type:'_http'}, function(service){
    console.log('found');
})

console.log('started');

3. result

Unlike other approach (i.e. Android app "Pea Finder" or running both in one system), the client side script based on "bonjour" didn't work. I tried to change the argument 'http' as well for both side. However, it doesn't work.

bus710 commented 7 years ago

I tried to figured out with various cases and Windows doesn't work at all for both being server and client. However, in Ubuntu and raspbian, any of those work very well.

In addition to my observation,

  1. note that the argument for find API should be 'http' not '_http'.
  2. note that the argument for avahi-publish-service should be '_http' not 'http'.

tricky tricky.

dzcpy commented 5 years ago

So how to get it work on Windows? Is there acually any way?

FrankFundel commented 4 years ago

Anything new on this?

bblanke commented 4 years ago

Also having issues on Windows. I'm on a Mac running Windows 10 using parallels.