-
Notifications
You must be signed in to change notification settings - Fork 58
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
Replace library to RxDnssd #17
Conversation
This is the ionic-native plugin file. https://gist.github.com/NeoLSN/b8a598dd3bcdbef9115d6d84d6ae6049 |
Hi @NeoLSN. That looks good. I started to switch over to RxDNSSD too. How's that working for you? Also is there a Rx implementation for iOS or is it just a Java stuff? |
The following is what happens to me: first, a service is discovered OK
then it's removed and re-added twice in a row
then it's removed and re-added 3 times in a row
and so on Weird behavior, isn't it? JmDNS is stable in comparison |
I just know RxDnssd used the same library like iOS used (on C code), so what the value it can return is the same as iOS did. |
Thanks for the info. Still it's a bit odd to me that "removed" should be triggered. I'm going to check if that happens on iOS too. |
iOS is stable. There's definitely something wrong with RxDNSSD. I'll try to change the javascript interface though. Thanks. |
We are waiting on some news from Andriy Druk at RxDNSSD. |
I'm seeing the same behaviour on the Android side on my app. The watcher callback seem to cache the results so i'm still seeing devices even after they have been disconnected from the network. Is there a fix available? |
@becvert I sent the mail last Friday, but didn't get any response since that time. |
@NeoLSN Thanks. We just have to wait then. |
Hi, there I’m so sorry for the delay. I spent the morning debugging your code and found a bad mistake. I saw that you just copied my code from Bonjour Browser, but it's not so simple. When I created this I made some assumption, but it wouldn't work for you. First of all your code never unregister services. It happens because of 'equals' function of BonjourService. I guess that it was my mistake include 'flags' to 'equals'. Please use another key for your hashmap. I'm going to investigate your browse function too bit later. @becvert yes, you can use Apple DNSSD API with my library. For your needs, it can be much better. |
subscriptions[0] = this.rxDnssd.register(bonjourService) | ||
.doOnNext(new Action1<BonjourService>() { | ||
public void call(BonjourService service) { | ||
registrations.put(service, subscriptions[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here 'service' has 'flags' = 2. Use 'bonjourService' instead or some string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
public Observable<BonjourService> register(BonjourService bonjourService) {
PublishSubject<BonjourService> subject = PublishSubject.create();
final Subscription subscription = this.rxDnssd.register(bonjourService)
.subscribe(subject);
registrations.put(bonjourService, subscription);
return subject;
}
Is this one better? @andriydruk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
Browse works ok, but there are few notes:
|
The part that shows your own device's registered services can be good as it is right now. First of all, it has always worked like that, so it comes as no surprise for every user of this plugin. Other than that, it can be useful for debugging purposes that the service you registered gets shown when browsing (you don't need two separate devices to debug the most trivial network operations). Lastly, it is not hard for the user software to check whether the discovered service is the one that has been registered on this device, or it is a service discovered from a remote device (if you don't like this idea, a possible solution can be to enable or disable such behaviour by a configuration flag).
|
@bugnano (and others) Please keep this PR clean. It's about AppleDNSSD and Rx. Thanks |
This plugin is meant to be just a wrapper around underlying libraries. |
@NeoLSN Please let me know if you're happy with the latest changes and if it's worth a new try for me. Thanks @andriydruk thanks for your feedback. |
@becvert I'm ok with that changes. I think it is worth for a try. We need to find a way to merge IPv4 and IPv6 records. |
@NeoLSN ok I'll try to do some tests again sometime, although I'm unsure whether fixes were made on the 'browse' side? About merging ipv4 and ipv6 I don't know. So if there are 2 'resolved' events per service it's fine with me. The issue I pointed out was more about some kind of memory leak. |
I 100% agree with you in the sense that a cordova plugin should be as a thin as a layer can be, but it also needs to take into account the platform differences (e.g. if Bonjour on iOS and RxDnssd on Android have a slightly different behaviour, it would be better to normalize these differences into the plugin itself, in order to have a consistent behaviour on the JS side). P.S. sorry for the off-topic contents of yesterday, but I don't know where to discuss such issues. |
I'll try to merge that on Java code and update the latest version let you know. |
Hi @NeoLSN |
@becvert |
OK. Thanks, |
You can try ou the RxDNSSD branch |
Closing old PR |
@becvert
I've done the Android library replacement.
Because I changed the plugin interface and I don't know swift 3.
Can you help me for the iOS part?