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

'up' event not firing for 'custom' type #8

Open
benoitlahoz opened this issue Jan 15, 2022 · 2 comments
Open

'up' event not firing for 'custom' type #8

benoitlahoz opened this issue Jan 15, 2022 · 2 comments

Comments

@benoitlahoz
Copy link

benoitlahoz commented Jan 15, 2022

Hi and thank you for the great work.

I create a new instance of 'bonjour-service'

const zeroconf = new Bonjour();

Then I publish a service, with the 'osc' (Open Sound Control) type:

const service = zeroconf.publish({
    name: 'my_name',
    port: 56032,
    type: 'osc',
    protocol: 'udp',
    txt: {
      test: 'TEST',
    },
});

service.on('up', () => {
  // This is fired, and 'published' entry is set to true.
  console.log('Service is up', service);
});

And I listen to all published services with this code:

const browser = zeroconf.find();
browser.on('up', (service: any) => {
  // This is not fired for my custom type.
  console.log('UP', service.name, service.type);
});

If I define the type of the service to an official type (IANA link included in the README) like 'http', the browser immediately handles the publication. But, with my 'custom' type (not so custom, OSC protocol and zeroconf 'osc' type are widely used, in real-time video softwares for example), the browser doesn't receive anything. I checked in your code and the publication is well received, but no event is fired.

Do I miss something?

Thank you.

@benoitlahoz benoitlahoz changed the title 'up' event not firing forr 'custom' type 'up' event not firing for 'custom' type Jan 15, 2022
@mdidon
Copy link
Member

mdidon commented Jan 26, 2022

Hi @benoitlahoz, if you specify let browser = service.find({ type: 'osc' }) are you able to see the service?

@benoitlahoz
Copy link
Author

benoitlahoz commented Feb 8, 2022

Thank you @mdidon, and sorry for the late response.
It doesn't work, browser's name is _osc._tcp.local.
If I search for { type: 'osc', protocol: 'udp' } it works!

When I launch const browser = zeroconf.find(), browser's name is _services._dns-sd._udp.local and it doesn't output my specific service.

As a side note, that could be important, the publish function increments a number on the host name at each launch: [hostname][-NUMBER].local

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