watson / bonjour

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

doesn't work with udp ? #52

Open bradwbradw opened 5 years ago

bradwbradw commented 5 years ago

Either it's starting up, but can't find the udp service, or it says it's starting up but it's not. no error messages are occurring. Here is the code:


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

var name = 'brad bonjour';
var type = 'a cool type';

var service = bonjour.publish({ 
    name, 
    type, 
    port: 3030,
    protocol: 'udp'
});
service.start();

service.on('error', error =>{
    console.log('error', error);
})

service.on('up', () => {
    console.log('it is now up');

})

bonjour.find({ type }, function (service) {
        if (service.name === name){
            console.log('found the service', service);
        } else {
            console.log('.');
        }
})

If the protocol is tcp, then i see the log event "found the service", but if i set the protocol to udp, there is no log event, but I would expect there to be one. Either way, i do see the "it is now up" log event