@cappitolian/network-discovery 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Package.swift CHANGED
@@ -10,7 +10,7 @@ let package = Package(
10
10
  targets: ["NetworkDiscoveryPlugin"])
11
11
  ],
12
12
  dependencies: [
13
- .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
14
14
  ],
15
15
  targets: [
16
16
  .target(
package/README.md CHANGED
@@ -35,7 +35,7 @@ import { NetworkDiscovery } from '@cappitolian/network-discovery';
35
35
  // Start advertising your server
36
36
  await NetworkDiscovery.startAdvertising({
37
37
  serviceName: 'MyAppServer',
38
- serviceType: '_http._tcp', // or '_myapp._tcp' for custom service
38
+ serviceType: '_http._tcp', // or '_myapp._tcp' for custom service to avoid conflicts with other services
39
39
  port: 8080,
40
40
  txtRecord: {
41
41
  ip: '192.168.1.100', // Your server IP
@@ -69,7 +69,7 @@ NetworkDiscovery.addListener('serviceLost', (service) => {
69
69
 
70
70
  // Start discovery
71
71
  await NetworkDiscovery.startDiscovery({
72
- serviceType: '_http._tcp', // Must match the server's serviceType
72
+ serviceType: '_http._tcp', // Must match the server's serviceType or '_myapp._tcp' for custom service to avoid conflicts with other services
73
73
  domain: 'local.' // Optional, defaults to 'local.'
74
74
  });
75
75
 
@@ -94,7 +94,7 @@ async startServer() {
94
94
  // Advertise server
95
95
  await NetworkDiscovery.startAdvertising({
96
96
  serviceName: 'MyAppServer',
97
- serviceType: '_myapp._tcp',
97
+ serviceType: '_http._tcp', // Must match the server's serviceType or '_myapp._tcp' for custom service to avoid conflicts with other services
98
98
  port: 8080,
99
99
  txtRecord: {
100
100
  ip: ip,
@@ -138,7 +138,7 @@ async findAndConnectToServer() {
138
138
 
139
139
  // Start discovery
140
140
  NetworkDiscovery.startDiscovery({
141
- serviceType: '_myapp._tcp'
141
+ serviceType: '_http._tcp' // Must match the server's serviceType or '_myapp._tcp' for custom service to avoid conflicts with other services
142
142
  });
143
143
 
144
144
  // Timeout after 10 seconds
@@ -179,13 +179,9 @@ public class NetworkDiscovery {
179
179
  // Agregar direcciones IP
180
180
  InetAddress host = serviceInfo.getHost();
181
181
  if (host != null) {
182
- try {
183
- JSONArray addresses = new JSONArray();
184
- addresses.put(host.getHostAddress());
185
- serviceData.put("addresses", addresses);
186
- } catch (JSONException e) {
187
- Log.e(TAG, "Error adding addresses", e);
188
- }
182
+ JSONArray addresses = new JSONArray();
183
+ addresses.put(host.getHostAddress());
184
+ serviceData.put("addresses", addresses);
189
185
  }
190
186
 
191
187
  // Agregar TXT records
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cappitolian/network-discovery",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "A Capacitor plugin for network service discovery using mDNS/Bonjour. Allows automatic server-client connection without manual IP configuration.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -52,10 +52,10 @@
52
52
  "prepublishOnly": "npm run build"
53
53
  },
54
54
  "devDependencies": {
55
- "@capacitor/android": "^7.0.0",
56
- "@capacitor/core": "^7.0.0",
55
+ "@capacitor/android": "^7.4.5",
56
+ "@capacitor/core": "^7.4.5",
57
57
  "@capacitor/docgen": "^0.3.1",
58
- "@capacitor/ios": "^7.0.0",
58
+ "@capacitor/ios": "^7.4.5",
59
59
  "@ionic/eslint-config": "^0.4.0",
60
60
  "@ionic/prettier-config": "^4.0.0",
61
61
  "@ionic/swiftlint-config": "^2.0.0",
@@ -68,7 +68,7 @@
68
68
  "typescript": "^5.9.3"
69
69
  },
70
70
  "peerDependencies": {
71
- "@capacitor/core": "^7.0.0"
71
+ "@capacitor/core": ">=7.0.0"
72
72
  },
73
73
  "prettier": "@ionic/prettier-config",
74
74
  "swiftlint": "@ionic/swiftlint-config",