-
Notifications
You must be signed in to change notification settings - Fork 6
Cannot use second mDNS browser in addition to NodeAPI's browser (used to search for RegistrationAPIs) #26
Copy link
Copy link
Open
Description
When the NodeAPI looks for a RegistrationAPI, it creates an mdns-js browser and starts discovery. There seems to be a bug in mdns-js where any new mdns-js browser created after the first will never emit 'update' events; the first browser will be the only one that gets update messages. Also, only the settings used for the first browser are active.
This means you cannot use mdns-js to search for a QueryAPI within the program that you are running the NodeAPI that is searching for a RegistrationAPI. In the example code below, I never see any log saying it has found a query server.
I realize this is a bug in mdns-js, not Ledger, but I know Ledger already has forked mdns-js, so this may be a bug to be fixed there.
Example code:
let ledger = require('nmos-ledger');
let mdns = require('mdns-js');
let ledger_Node = new ledger.Node(null, null, "Ledger Node", "http://127.0.0.1", "LedgerNode");
let ledger_NodeRAMStore = new ledger.NodeRAMStore(ledger_Node);
let ledger_NodeAPI = new ledger.NodeAPI(3000, ledger_NodeRAMStore, "127.0.0.1");
ledger_NodeAPI.init().start(() => {
let browser = mdns.createBrowser(mdns.tcp('nmos-query'));
browser.on('ready', () => {
browser.discover();
});
browser.on('update', (data) => {
if (data.fullname && data.fullname.indexOf('_nmos-query._tcp') >= 0) {
console.log("Found a query service.", data.fullname, data.txt.length > 0 ? data.txt : "");
}
});
browser.on('error', () => {
console.error.bind(null, "mDNS Browser error!");
});
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels