Created
December 22, 2017 01:24
-
-
Save tuliofaria/273a4daa11dd0a6b5673737ae174e081 to your computer and use it in GitHub Desktop.
Discovering Chromecasts in local network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"mdns": "^2.3.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment