Open NeoLSN opened 8 years ago
@andriydruk are you planning to work on this issue? We've integrated your library into our project and really love it. But it is really frustrating when bonjour devices frequently appear/disappear from the list.
Actually, I can't reproduce it with my sample app What kind of device do you discover? Is it an Android device which is registered through RxDNSSD?
@andriydruk I've modified your sample app in order to see all the added/removed services in the console log:
protected void startDiscovery() {
mSubscription = mRxDnssd.browse(mReqType, mDomain)
.compose(mRxDnssd.resolve())
.compose(mRxDnssd.queryRecords())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(bonjourService -> {
int itemsCount = mAdapter.getItemCount();
if (!bonjourService.isLost()) {
Log.d("DNSSD", "Add: " + bonjourService.getServiceName());
mAdapter.add(bonjourService);
} else {
Log.d("DNSSD", "Remove: " + bonjourService.getServiceName());
mAdapter.remove(bonjourService);
}
showList(itemsCount);
mAdapter.notifyDataSetChanged();
}, throwable -> {
Log.e("DNSSD", "Error: ", throwable);
showError(throwable);
});
}
And that's what I received in the console:
11-08 11:11:57.893 27521-27521/com.druk.bonjour.browser D/DNSSD: Add: Mevo-20938
11-08 11:13:15.443 27521-27521/com.druk.bonjour.browser D/DNSSD: Remove: Mevo-20938
11-08 11:13:15.793 27521-27521/com.druk.bonjour.browser D/DNSSD: Add: Mevo-20938
As you see, device disappears and then appears back in 300 ms.
If it wasn't reported by @NeoLSN before I'd say that this was a problem with our WiFi network. But since the same issue happens for another people I think this is a problem somewhere in the library. In addition, we didn't have such behavior when were using another Bonjour libraries.
Tested on Samsung Galaxy S7 Edge Android 6.0.1.
Ok, I see. It looks more like another way of broadcasting information in a network. I saw the similar behavior of Bonjour Sleep Proxy services. This is a way it works. I don't think it's an issue with the library.
Furthermore, I don't write a library for discovering Bonjour Service I provide a wrapper for mDnsResponder which was developed by Apple. And it looks like a behavior of this library. The only thing I can do is check if there is a new version.
I can recommend you to add some additional logic on your side. I've done this before in my commercial project for Bonjour Sleep Proxy.
I can recommend you to add some additional logic on your side. I've done this before in my commercial project for Bonjour Sleep Proxy.
We've already done this. But I feel that this is not the way how it should be (if it is an issue and not the expected behavior of the network). Please, update the library to the latest version of Apple's dns browser.
I've pushed an update to master Please try to build it from source
@andriydruk this update didn't help. I'd say it became even worse:
11-15 10:42:46.573 10947-10947/com.livestream.mevo D/WifiBrowser: Added: Mevo-20938 wifi 1ms
11-15 10:42:50.503 10947-10947/com.livestream.mevo D/WifiBrowser: Removed: Mevo-20938 wifi 3928ms
11-15 10:42:50.723 10947-10947/com.livestream.mevo D/WifiBrowser: Added: Mevo-20938 wifi 0ms
11-15 10:42:51.433 10947-10947/com.livestream.mevo D/WifiBrowser: Removed: Mevo-20938 wifi 710ms
11-15 10:42:51.483 10947-10947/com.livestream.mevo D/WifiBrowser: Added: Mevo-20938 wifi 1ms
11-15 10:42:51.493 10947-10947/com.livestream.mevo D/WifiBrowser: Updated: Mevo-20938 wifi 0ms
11-15 10:42:53.503 10947-10947/com.livestream.mevo D/WifiBrowser: Removed: Mevo-20938 wifi 2015ms
11-15 10:42:53.713 10947-10947/com.livestream.mevo D/WifiBrowser: Added: Mevo-20938 wifi 0ms
11-15 10:42:53.723 10947-10947/com.livestream.mevo D/WifiBrowser: Updated: Mevo-20938 wifi 0ms
11-15 10:43:03.783 10947-10947/com.livestream.mevo D/WifiBrowser: Removed: Mevo-20938 wifi 10053ms
11-15 10:43:04.013 10947-10947/com.livestream.mevo D/WifiBrowser: Added: Mevo-20938 wifi 0ms
11-15 10:43:04.063 10947-10947/com.livestream.mevo D/WifiBrowser: Updated: Mevo-20938 wifi 1ms
11-15 10:43:04.063 10947-10947/com.livestream.mevo D/WifiBrowser: Updated: Mevo-20938 wifi 1ms
11-15 10:43:14.163 10947-10947/com.livestream.mevo D/WifiBrowser: Removed: Mevo-20938 wifi 10097ms
11-15 10:43:14.353 10947-10947/com.livestream.mevo D/WifiBrowser: Added: Mevo-20938 wifi 1ms
11-15 10:43:14.423 10947-10947/com.livestream.mevo D/WifiBrowser: Updated: Mevo-20938 wifi 0ms
11-15 10:43:14.423 10947-10947/com.livestream.mevo D/WifiBrowser: Updated: Mevo-20938 wifi 0ms
11-15 10:43:22.833 10947-10947/com.livestream.mevo D/WifiBrowser: Removed: Mevo-20938 wifi 8411ms
@gennadiiivanov Could you potentially work around this with the .debounce()
operator?
Can you help me to answer why the rxdnssd browser add/remove same service so quickly? https://github.com/becvert/cordova-plugin-zeroconf/pull/17
┆Issue is synchronized with this Asana task