agnat / node_mdns

mdns/zeroconf/bonjour service discovery add-on for node.js
http://agnat.github.com/node_mdns
MIT License
868 stars 145 forks source link

Issues with Airplay. #240

Closed lukewberg closed 4 years ago

lukewberg commented 4 years ago

Not sure if I'm just doing something wrong here, but here's the issue.

Using this code, I get nothing logged to the terminal:

const browser = mdns.createBrowser(mdns.tcp('airplay'));
browser.on('serviceUp', service => {
    console.log("service up: ", service);
});
browser.on('serviceDown', service => {
    console.log("service down: ", service);
});
browser.start();

the curious thing is that when I use the browseThemAll() method, I can find it:


const all_the_types = mdns.browseThemAll();

all_the_types.on('serviceUp', service => {
    if (service.type.name === 'airplay') {
        console.log(service)
    }
})

all_the_types.start()
{
  interfaceIndex: 1,
  type: ServiceType { name: 'airplay', protocol: 'tcp', subtypes: [] },
  replyDomain: '.',
  flags: 3,
  networkInterface: 'lo0'
}
{
  interfaceIndex: 6,
  type: ServiceType { name: 'airplay', protocol: 'tcp', subtypes: [] },
  replyDomain: '.',
  flags: 3,
  networkInterface: 'en0'
}

Of course, these service objects do not have all of the useful properties that you would normally have if mdns.createBrowser(mdns.tcp('airplay')); worked; is there a fix for this?

lukewberg commented 4 years ago

I have an update on this. The device with airplay is a new Samsung TV. It seems that it goes in and out of discoverability. Sometimes I will get the service object outputted to the terminal, other times not. Using the "Discovery" app to browse the Bonjour stuff, the airplay category will go between 0 and 1 items randomly.

This does not seem to be an issue with node_mdns, sorry for the wasted issue.