Skip to content
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

Discover services that have already been announced or trigger again the announcement #13

Open
AltarBeastiful opened this issue Apr 8, 2022 · 1 comment

Comments

@AltarBeastiful
Copy link

I'm using Bonjour to connect a few components as a mesh network. As soon as they start and connect to hte network, each components publish a service and find all existing services using a custom type.

Sometimes a service will connect to the network after the existing services have finished their initial service announcement.
In that case the new service announce and gets discovered by the network but the existing services cannot be found by the new service as their initial announcement has already stopped.

Is there any mechanism I can use to make the new service discover the existing ones ?

From reading the RFC, I could see there's two possible options :

  • Restart the announcement for existing service as a network change has happened
  • Existing services should answer PTR query triggered by the new service as they browse for matching service. Right now only the initial service announcement seems to answer those queries.

As a side note, I'm using different instance in each component for browsing and publishing as they should publish on a specific interface, but can browse on any interface :

this.bonjourBrowser = new Bonjour();
this.bonjourSender = new Bonjour({
  loopback: false,
  interface: 169.254.9.6,
});

this.bonjourSender.publish({
        type: 'MyCustomType',
        name: 'AUniqueComponentName',
        port: 3000,
        host: 169.254.9.6
});

this.bonjourBrowser.find(
      { type: 'MerckDevice' },
      (service) => {
      // Register new service
      }
);
@AltarBeastiful AltarBeastiful changed the title Discover services that have already been announced or triger agian the annoucement Discover services that have already been announced or trigger again the announcement Apr 13, 2022
@mdidon
Copy link
Member

mdidon commented May 3, 2022

@AltarBeastiful Thanks for highlighting this. We've run into similar issues when using the library in some of our other projects and it is on the list to improve.
Out of interest, what platform and node version are you currently using?

Thanks,
Matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants