Skip to content

Instantly share code, notes, and snippets.

@tuliofaria
Created December 22, 2017 01:24
Show Gist options
  • Save tuliofaria/273a4daa11dd0a6b5673737ae174e081 to your computer and use it in GitHub Desktop.
Save tuliofaria/273a4daa11dd0a6b5673737ae174e081 to your computer and use it in GitHub Desktop.
Discovering Chromecasts in local network
const mdns = require('mdns')
const browser = mdns.createBrowser(mdns.tcp('googlecast'))
browser.on('serviceUp', service => {
const { md, fn } = service.txtRecord
console.log(md, fn)
})
browser.on('serviceDown', service => {
const { md, fn } = service.txtRecord
console.log(md, fn)
})
setTimeout(() => {
browser.stop()
}, 5000)
browser.start()
{
"dependencies": {
"mdns": "^2.3.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment