-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Description
Description
I am trying to create a small browser, but I am finding that the responses with browseThemAll() aren't including addresses
const allTheTypes = mdns.browseThemAll({});
allTheTypes.on('serviceUp', service => {
console.log('service up', service.addresses, service);
});As reference when used by itself this does work:
const browser = mdns.createBrowser(mdns.tcp('smb'));
browser.on('serviceUp', service => {
console.log('service up: ', service);
});
browser.on('serviceDown', service => {
console.log('service down: ', service);
});Since this worked, I tried the following, and while it does provide values for both host and addresses, I am wondering whether this is the way we need to be doing things:
const browserByType: Record<string, Browser> = {};
const allTheTypes = mdns.browseThemAll({ });
allTheTypes.on('serviceUp', service => {
const serviceType = service.type;
const type = `${serviceType.name}.${serviceType.protocol}`;
if (!browserByType[type]) {
if (service.type.protocol == 'tcp') {
console.log(`Creating browser for ${serviceType.name}`);
const subBrowser = mdns.createBrowser(mdns.tcp(serviceType.name));
// Not getting any events generated here:
subBrowser.on('serviceUp', service => {
console.log('XXX service up', service);
})
subBrowser.start();
browserByType[type] = subBrowser;
}
}
});Version Info
OS: macOS 15.6.1
node: v20.19.0
mdns: 2.7.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels