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

Notify when service is lost #28

Closed
Nimrodda opened this issue Feb 7, 2022 · 5 comments · Fixed by #31
Closed

Notify when service is lost #28

Nimrodda opened this issue Feb 7, 2022 · 5 comments · Fixed by #31
Labels
enhancement New feature or request

Comments

@Nimrodda
Copy link
Owner

Nimrodda commented Feb 7, 2022

Right now the plugin sends events of services appearing, but no events when they disappear.
According to my brief investigation, Android, iOS and MacOS support this, but Windows which uses the MDNS library requires further investigation.

@jnstahl Do you happen to know if MDNS supports this?

@Nimrodda Nimrodda added the enhancement New feature or request label Feb 7, 2022
@jnstahl
Copy link
Contributor

jnstahl commented Feb 7, 2022

At the core, MDNS sends a broadcast out, in essence "who supports _http._tcp." and all the devices who do will send a reply.
The only way to tell if a service has gone away is to continuously broadcast, keep a database of known responses and then compare if a service that was there before no longer responds.

For iOS and Android, this is something the OS keeps track of internally, presumably the OS will periodically broadcast regardless if any query is open, and the API only allows you to get a notification of the internal database.

Emulating the same behavior on windows would probably be excessive, as here the broadcasting is done by the app directly, not by the OS. And, it would also be non-trivial to keep track of things as possibly not each device will respond every single time, so one would have to have an algorithm tracking additions and removals.

@jnstahl
Copy link
Contributor

jnstahl commented Feb 7, 2022

I guess it all depends on what the use case is here. If an app wants to monitor what is available in the network continuously, the removal notification is essential. I would think that most apps will use the flutter_nsd package just to connect to something (lets say a printer), then be done with it. At least that is how I use it.

@Nimrodda
Copy link
Owner Author

Nimrodda commented Feb 8, 2022

Yeah, it's the same use case I have. In my case I don't even list the available devices if there's only one, but just connect to it directly. I came up with this after addressing #27. I realized we have the API in place, but it's actually not used 😅
I see you already created a PR for this. Great stuff! Thanks once again for such swift action 💪

@Nimrodda Nimrodda reopened this Feb 8, 2022
@jnstahl
Copy link
Contributor

jnstahl commented Dec 3, 2023

why is this issue re-opened? any issues with my fix?

@Nimrodda
Copy link
Owner Author

Nimrodda commented Dec 4, 2023

I don't remember. Probably a mistake.

@Nimrodda Nimrodda closed this as completed Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants