-
Notifications
You must be signed in to change notification settings - Fork 79
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
feat(binding-coap): implement DNS-SD via mDNS #963
Conversation
I feel like the same code can be used to expose the same endpoints using HTTP. For this reason, it makes sense to do more software engineering... I like the idea of having dedicated packages also for "introduction methods", bindings that will then advertise an URL to the core and the core will forward it to the installed discovery services. This would works also for Directory and it might solve some of the issues we experienced. |
Oh, that's a very good idea! I will try to encapsulate the code as much as possible (currently, it's still very WIP) so that we can also reuse it in other places (moving it to its own package). |
The introduction logic is now moved inside a new |
I think this PR would now be ready for review :) |
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.
As always thank you really much for your efforts @JKRhb ! I like the MdnsIntroducer interface, do you think we can in the future move it to its own package? Or are there some blockers that we need to take into account? Have you considered renaming MdnsIntroducer
to MdnsIntroductionMethod
?
Finally, I would add some basic tests (as we did with Zion https://github.com/vaimee/zion/blob/main/test/unit/introduction/mdns.spec.ts) and fix the issue below.
Moving it to its own package sounds good to me :) I was wondering, though: Should it become a package on its own? Or should it be a collection of introduction mechanisms? Maybe we can also discuss these questions in a dedicated issue.
We can surely rename it,
Oh, sure! Unfortunately, I am a bit occupied for the next few days but I will try to add some tests over the course of the weekend :) |
I agree about having some more discussions about where to place it. |
I agree that we currently don't have a nice package to fit this class. Having a single package just for this seems overkill. It depends on which other introduction methods we want to support and how much they are different from each other. |
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.
A small comment below + there is a conflict with the master.
|
||
public async close(): Promise<void> { | ||
return new Promise((resolve) => { | ||
this.mdns.destroy(resolve); |
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 checked https://nodejs.org/api/net.html#serverclosecallback and I saw that the callback is called with an error if the server was not open before. I know that it might be a kind of impossible state, but maybe it is worth handling this corner case as well. @JKRhb what do you think?
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.
Signed-off-by: JKRhb <jan.romann@uni-bremen.de>
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.
Perfect! merging.
@JKRhb can you update the testing results in wot-testing accordingly? I think this is really cool and it should help with it ;) |
Sure! I will open a PR in the testing repo shortly :) With this new implementation, the assertion should actually be covered already :) |
This PR adds DNS-SD functionality (via mDNS) to the
binding-coap
package in order to cover the respective assertion from the Discovery specification.I still need to do some interoperability testing, therefore I opened this PR only as a draft for now. However, hopefully the PR will be ready for review soon :)