Skip to content

It does not seem like publish() actually publishes publicly properly #46

@StefanWallin

Description

@StefanWallin

This might be duplicate of #9 or #13, if that's the case I'm sorry!

🥂 🍻 Thanks in advance for great work with open sourcing this. 🎉

I'm trying this on:

  • Mac OS Sonoma 14.2.1 on a M1 Apple Silicon
  • npx ts-node -v: v10.9.2
  • node -v: `v18.13.0
  • Discovery.app 2.1.0 (6)

Description

I'm trying to implement the react-native-zeroconf library in my react native app and serve from my server with your bonjour-service, but It does not seem that the announce from this library is reaching the network properly.

If I use the Discovery App I can see services such as Airplay and others, but not whatever I announce from this library.

If I try to scan for airplay over tcp with react-native-zeroconf I get matches from within my iOS simulator I will see my apple TV which is only connected by bluetooth even.

My setup

index.ts

import Bonjour from "bonjour-service";

const init = async () => {
  const instance = new Bonjour();
  console.log("Publishing bonjour service");
  const a = instance.publish({
    name: "TestApp Desktop Server",
    type: "testapp",
    protocol: "tcp",
    port: 3000,
  });

  while (true) {
    // keep the process alive
    await new Promise((resolve) => setTimeout(resolve, 4000));
    console.log("instance", a);
    await new Promise((resolve) => setTimeout(resolve, 2000));
    console.log("Waiting...");
  }
};

init();

It will output something like this:

instance Service {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  probe: true,
  published: true,
  activated: true,
  destroyed: false,
  txtService: DnsTxt { binary: undefined },
  name: 'TestApp Desktop Server',
  protocol: 'tcp',
  type: '_testapp._tcp',
  port: 3000,
  host: 'carambola-124.local',
  fqdn: 'TestApp Desktop Server._testapp._tcp.local',
  txt: undefined,
  subtypes: undefined,
  disableIPv6: false,
  start: [Function: bound start],
  stop: [Function: bound stop],
  [Symbol(kCapture)]: false
}
Waiting...

If I use bounjour-service as client it works, but not ideal for a react native environment, and it's weird that other applications cannot see the announcement either.
Screenshot 2024-01-05 at 19 24 39

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions