bonjour-hap 3.6.4 → 3.7.0
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/README.md +6 -2
- package/lib/Browser.js +20 -2
- package/lib/Server.js +2 -2
- package/lib/Service.js +1 -1
- package/lib/utils/network.js +1 -1
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
5
|
-
](https://github.com/homebridge/bonjour/actions/workflows/nodejs.yml)
|
|
6
6
|
[](https://coveralls.io/github/homebridge/bonjour?branch=master)
|
|
7
7
|
|
|
8
8
|
A Bonjour/Zeroconf protocol implementation in pure JavaScript. Publish
|
|
@@ -112,6 +112,10 @@ Options are the same as given in the `browser.find` function.
|
|
|
112
112
|
|
|
113
113
|
Emitted every time a new service is found that matches the browser.
|
|
114
114
|
|
|
115
|
+
#### `Event: update`
|
|
116
|
+
|
|
117
|
+
Emitted every time an update is received for existing service is found that matches the browser.
|
|
118
|
+
|
|
115
119
|
#### `Event: down`
|
|
116
120
|
|
|
117
121
|
Emitted every time an existing service emmits a goodbye message.
|
|
@@ -136,7 +140,7 @@ Broadcast the query again.
|
|
|
136
140
|
|
|
137
141
|
#### `Event: up`
|
|
138
142
|
|
|
139
|
-
Emitted when the service is up.
|
|
143
|
+
Emitted when the service is up, and if the txt record of the service is updated `service.updateTxt(object)`.
|
|
140
144
|
|
|
141
145
|
#### `Event: error`
|
|
142
146
|
|
package/lib/Browser.js
CHANGED
|
@@ -82,8 +82,11 @@ Browser.prototype.start = function () {
|
|
|
82
82
|
if (matches.length === 0) return
|
|
83
83
|
|
|
84
84
|
matches.forEach(function (service) {
|
|
85
|
-
if (self._serviceMap[service.fqdn])
|
|
86
|
-
|
|
85
|
+
if (self._serviceMap[service.fqdn]) {
|
|
86
|
+
self._updateService(service)
|
|
87
|
+
} else {
|
|
88
|
+
self._addService(service)
|
|
89
|
+
}
|
|
87
90
|
})
|
|
88
91
|
})
|
|
89
92
|
}
|
|
@@ -109,6 +112,21 @@ Browser.prototype._addService = function (service) {
|
|
|
109
112
|
this.emit('up', service)
|
|
110
113
|
}
|
|
111
114
|
|
|
115
|
+
Browser.prototype._updateService = function (service) {
|
|
116
|
+
let cachedService, index
|
|
117
|
+
this.services.some(function (s, i) {
|
|
118
|
+
if (dnsEqual(s.fqdn, service.fqdn)) {
|
|
119
|
+
cachedService = s
|
|
120
|
+
index = i
|
|
121
|
+
return true
|
|
122
|
+
}
|
|
123
|
+
return false
|
|
124
|
+
})
|
|
125
|
+
if (!cachedService) return
|
|
126
|
+
this.services[index] = service
|
|
127
|
+
this.emit('update', service)
|
|
128
|
+
}
|
|
129
|
+
|
|
112
130
|
Browser.prototype._removeService = function (fqdn) {
|
|
113
131
|
let service, index
|
|
114
132
|
this.services.some(function (s, i) {
|
package/lib/Server.js
CHANGED
package/lib/Service.js
CHANGED
package/lib/utils/network.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bonjour-hap",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "A Bonjour/Zeroconf implementation in pure JavaScript (for HAP)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)",
|
|
@@ -41,16 +41,15 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"array-flatten": "^2.1.2",
|
|
44
|
-
"deep-equal": "^2.
|
|
44
|
+
"deep-equal": "^2.2.3",
|
|
45
45
|
"multicast-dns": "^7.2.5",
|
|
46
|
-
"multicast-dns-service-types": "^1.1.0"
|
|
47
|
-
"ip": "^1.1.8"
|
|
46
|
+
"multicast-dns-service-types": "^1.1.0"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
49
|
"after-all": "^2.0.2",
|
|
51
|
-
"standard": "^17.
|
|
52
|
-
"tape": "^5.
|
|
50
|
+
"standard": "^17.1.0",
|
|
51
|
+
"tape": "^5.7.5",
|
|
53
52
|
"nyc": "^15.1.0",
|
|
54
|
-
"rimraf": "^
|
|
53
|
+
"rimraf": "^5.0.5"
|
|
55
54
|
}
|
|
56
55
|
}
|