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

subtypes not being shared on advertisement callbacks? #214

Open
jedahan opened this issue Apr 24, 2018 · 0 comments
Open

subtypes not being shared on advertisement callbacks? #214

jedahan opened this issue Apr 24, 2018 · 0 comments

Comments

@jedahan
Copy link

jedahan commented Apr 24, 2018

Not sure if this is a problem with the browser, the advertisement, or my understanding of mdns, but I created a repository to show that this fails:

const mdns = require('mdns')

const servicesStrings = [
  mdns.tcp('http', 'livingroom').toString(),
  mdns.udp('osc', 'livingroom').toString(),
  mdns.tcp('socketio', 'livingroom').toString()
]

console.dir({servicesStrings})

for (let serviceString of servicesStrings) {
  const service = mdns.makeServiceType(serviceString)
  const browser = mdns.createBrowser(service)

  browser.on('serviceUp', ({type}) => {
    const found = servicesStrings.includes(type.toString())
    console.log(`${type.toString()} ${found ? 'found' : 'not found'} in services`)
  })

  browser.start()
}

let port = 3000
for (let serviceString of servicesStrings) {
  const service = mdns.makeServiceType(serviceString)
  const advertisement = mdns.createAdvertisement(service, port++)
  advertisement.start()
}
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

1 participant