ReadonlyaddressesIP address strings (IPv4 and/or IPv6) populated after resolve() completes.
ReadonlydomainThe mDNS domain (almost always "local.").
ReadonlyhostnameThe resolved hostname, or null before resolve() completes.
ReadonlyidentifierA unique identifier assigned to this service object.
Whether peer-to-peer Bluetooth/Wi-Fi is included in resolution.
ReadonlynameThe service name (e.g. "My Web Server").
ReadonlyportThe service port. -1 until resolve() completes.
ReadonlytxtThe TXT record as a {key: value} object, or null if none is available.
Populated after resolve() completes or when updated via monitor().
ReadonlytypeThe service type string (e.g. "_http._tcp.").
Starts monitoring the TXT record for changes. The callback fires whenever the TXT record is updated.
Call stopMonitoring() to unsubscribe.
Called when TXT data changes with the updated record
self, for chaining
Resolves the hostname, port, addresses, and TXT record of this service.
The callback is called with (event) or (event, errorMessage):
"resolved" — resolution complete; read hostname, port, addresses, txtRecord"stopped" — resolution stopped before completing"error" — resolution failed; error message in second argumentseconds before giving up; pass 0 for no timeout
Called on status changes with event name and optional error message
self, for chaining
Returns a plain object describing this service, for JSON serialisation
JSON.stringify() calls this automatically, so you rarely need to call it yourself.
An object with the service's name, type, domain, hostname, port, addresses, txtRecord and includesPeerToPeer. hostname and txtRecord are null until the service has been resolved
A discovered Bonjour service record. Call
resolve()to look up its hostname, port, and addresses.Instances are delivered by an
HSBonjourSearchcallback. Callresolve()to discover their hostname, port, and addresses, and optionallymonitor()to watch for TXT record changes.Callback events
resolve()"resolved"resolve()"stopped"resolve()"error"monitor()"txtRecord"