Open Aymkdn opened 1 month ago
FYI, I tried another plugin that works much faster:
npm install @ionic-native/zeroconf cordova-plugin-zeroconf
And in my app:
import { Zeroconf } from "@ionic-native/zeroconf"
[…]
Zeroconf.registerAddressFamily = 'ipv4';
Zeroconf.watchAddressFamily = 'ipv4';
Zeroconf.watch("_fbx-api._tcp.", "local.").subscribe(result => {
if (result.action === "resolved") {
Zeroconf.unwatch('_fbx-api._tcp.', 'local.');
Zeroconf.close();
this.modal.debug.zeroconf = "RESOLVED";
let ip = result.service.ipv4Addresses[0];
if (ip) {
this.modal.debug.zeroconf = "OK";
this.freeboxIP = ip;
}
} else {
this.modal.debug.zeroconf = result.action;
}
});
Logcat:
2024-08-02 16:37:27.980 10951-11122 ZeroConf D Added 2024-08-02 16:37:27.981 10951-11122 ZeroConf D Sending result: {"action":"added","service":{"domain":"local.","type":"_fbx-api._tcp.","name":"Freebox Server","port":0,"hostname":"Freebox Server._fbx-api._tcp.local.","ipv4Addresses":[],"ipv6Addresses":[],"txtRecord":{"Freebox Server._fbx-api._tcp.local.":"true"}}} 2024-08-02 16:37:27.983 10951-11122 ZeroConf D Resolved 2024-08-02 16:37:27.984 10951-11122 ZeroConf D Sending result: {"action":"resolved","service":{"domain":"local.","type":"_fbx-api._tcp.","name":"Freebox Server","port":80,"hostname":"","ipv4Addresses":["192.168.0.254"],"ipv6Addresses":[],"txtRecord":{"https_port":"23121","uid":"5c8d5a13cf46a227ee6ad7d0fd192b9a","https_available":"1","box_model_name":"Freebox v7 (r1)","device_type":"FreeboxServer7,1","api_domain":"gqtfxpb7.fbxos.fr","box_model":"fbxgw7-r1\/full","api_base_url":"\/api\/","api_version":"12.0"}}} 2024-08-02 16:37:28.299 10951-11040 ZeroConf D Unwatch _fbx-api._tcp.local. 2024-08-02 16:37:28.300 10951-11040 ZeroConf D Close 2024-08-02 16:37:31.834 10951-11130 ProfileInstaller D Installing profile for info.kodono.pop_files
The plugin causes a 20-30 seconds delay to my app.
Here is what I'm doing:
And here is the logcat:
If I remove the code, my app works just fine. Am I doing something incorrect?