-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement backwards-compatible discovery API that uses mDNS #89
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.found = [] | ||
const bonjourProps = ['_server', '_registry'].join(',') | ||
const mdnsProps = ['dns_sd', 'Advertisement', 'createAdvertisement', 'Browser'].join(',') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we testing that the order of the keys is exactly this and these are the first keys?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First keys was just bcs I didn't want to compare every key, seemed uncessary. My thinking re the order was that, if the order didn't match, chances are that it's a different module with similar methods or a very different version of the module. That way we have a loose version check, which would catch any major changes to those modules (i.e. fingerprinting)
I would have preferred a way to check the modules identity, but I don't think that's possible besides fingerprinting. If you know of a better way that allows us to check that a module is mdns
or bonjour
, and that the version is within a supported range, I'm all ears :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just call hasOwnProperty
on the prop names and be done with it. Relying on the order seems needlessly brittle.
…ole normalisation
This PR brings back compatibility with mDNS, alongside Bonjour, so that the current build doesn't break compatibility anymore. Also contains an unit test for said behaviour.