Scan your local network for mDNS devices.
npm install multicast-scannerScanner is set to scan for Chromecasts by default. Service name and type to scan for can be set when launching scan.
Defaults:
``javascript`
{
ttl: 7000,
interval: 2500,
full_scan: false,
name: null,
friendly_name: null,
service_name: '_googlecast._tcp.local',
service_type: 'PTR',
mdns: {}
}
The mdns object in options is passed to multicast-dns and can be used to alter its defaults.
javascript
var scanner = require('multicast-scanner');scanner({ full_scan: true }, (err, devices) => {
if(err) return console.log(err.message);
devices.forEach(device => {
console.log(device);
});
});
``javascript
/* Example Output:
{ name: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.local',
friendlyName: 'My Chromecast',
ip: '192.168.1.XXX',
port: 8009 }
*/
`$3
npm install multicast-scanner`