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

How to know when a service goes away? #65

Open
probonopd opened this issue Nov 3, 2019 · 4 comments
Open

How to know when a service goes away? #65

probonopd opened this issue Nov 3, 2019 · 4 comments

Comments

@probonopd
Copy link

https://github.com/grandcat/zeroconf#browse-for-services-in-your-local-network shows how to browse for services. But how can we catch the event when a service goes away?

avahi-browse -ar shows such events with

- enp0s25 IPv6 Go web server                                 Web Site             local
@frank-xlj
Copy link

frank-xlj commented Apr 28, 2021

I have the same question, and also how to unregister the service? Anybody knows if it's supported or not.
Hi @probonopd, have you found a way to get the notification when service goes away? I saw a PR is using TTL to distinguish the service is new added or removed. not sure if it makes sense.

@probonopd
Copy link
Author

Unfortunately I have not found a way so far, but I did not search very deeply.

@betamos
Copy link

betamos commented Aug 1, 2023

Second this, it's critical for keeping an up-to-date data structure of current clients. We'd need to:

  1. Allow the user to know about expired service entries through the TTL values.
  2. Handle "goodbye packets", which should expire a previously seen service entry immediately.

My understanding is that currently none of these "events" are available to the user, in that neither continuously refreshed entries, nor if they're expired through (1) or (2), will emit any new events after the initial discovery. Only the initial discovery is reliably observed.

Both are addressed in open PRs #93 and #60. However, they may conflict with each other as-is. For reference, in libp2p#31 both types of disconnects can be detected reliably and without duplicates.

Happy to help any way I can.

@probonopd
Copy link
Author

Thanks @betamos, looking forward to seeing PRs #93 and #60 being integrated into main.

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

3 participants