Sets or updates the txt of the service.
+The updated txt record.
+If set to true no announcement is sent for the updated record.
+A Responder instance represents a running MDNSServer and a set of advertised services.
+A Responder instance represents a running MDNSServer and a set of advertised services.
It will handle any service related operations, like advertising, sending goodbye packets or sending record updates. -It handles answering questions arriving on the multicast address.
-Creates a new CiaoService instance and links it to this Responder instance.
-Defines all information about the service which should be created.
-The newly created CiaoService instance can be used to advertise and manage the created service.
-Creates a new CiaoService instance and links it to this Responder instance.
+Defines all information about the service which should be created.
+The newly created CiaoService instance can be used to advertise and manage the created service.
+This method should be called when you want to unpublish all service exposed by this Responder. This method SHOULD be called before the node application exists, so any host on the network is informed of the shutdown of this machine. Calling the shutdown method is mandatory for a clean termination (sending goodbye packets).
The shutdown method must only be called ONCE.
-The Promise resolves once all goodbye packets were sent +
The Promise resolves once all goodbye packets were sent (or immediately if any other users have a reference to this Responder instance).
-Const
Defines the transport protocol of a service.
+Const
Defines the transport protocol of a service.
As of RFC 6763 7. TCP must be used for any applications using tcp. For applications using any other transport protocol UDP must be used. This applies to all other transport protocols like SCTP, DCCP, RTMFP, etc
-Const
Events thrown by a CiaoService
-Event is called when the Prober identifies that the hostname for the service is already used +
Const
Events thrown by a CiaoService
+Event is called when the Prober identifies that the hostname for the service is already used and thus resolve the name conflict by adjusting the hostname (e.g. adding '(2)' to the hostname). The name change must be persisted. As the hostname is an optional parameter, it is derived from the service name if not supplied. If you supply a custom hostname (not automatically derived from the service name) you must hook up a listener to this event in order for the hostname to be persisted.
-Event is called when the Prober identifies that the name for the service is already used +
Event is called when the Prober identifies that the name for the service is already used and thus resolve the name conflict by adjusting the name (e.g. adding '(2)' to the name). This change must be persisted and thus a listener must hook up to this event in order for the name to be persisted.
-Const
This enum defines some commonly used service types. +
Const
This enum defines some commonly used service types. This is also referred to as service name (as of RFC 6763). A service name must not be longer than 15 characters (RFC 6763 7.2).
-This method is used to get a responder for the provided (optional) set of options.
+This method is used to get a responder for the provided (optional) set of options.
Ciao tries to create as few Responder instances as possible. Thus, it will share the same Responder instance for the same set of options.
-Optional
options: ResponderOptionsIf specified, the options will be passed to the underlying mdns server.
-A Responder instance for the given options. Might be shared with others using the same options.
-Optional
options: ResponderOptionsIf specified, the options will be passed to the underlying mdns server.
+A Responder instance for the given options. Might be shared with others using the same options.
+ciao
is a RFC 6763 compliant dns-sd
library,
advertising on multicast dns (RFC 6762)
implemented in plain Typescript/JavaScript.
It is used in HAP-NodeJS and is the successor of the -bonjour-hap (and bonjour) library, +
It is used in HAP-NodeJS and is the successor of the +bonjour-hap (and bonjour) library, aiming to be more robust, more maintainable and RFC compliant (read Notice).
ciao
features a multicast dns responder to publish service on the local network.
It will eventually gain browsing functionality in the future to also discover services on the local network
-(There is currently no schedule when discover functionality will arrive.
+(There is currently no schedule when discover functionality will arrive.
A possible querier implementation is limited as explained in RFC 6762 15.1.
as it can't receive unicast responses).
ciao
passes the Bonjour Conformance Test
@@ -38,14 +31,14 @@
The full documentation can be found here.
This section links to the most important aspects of the documentation as used in the example above.
-First of all the getResponder function +
First of all the getResponder function should be used to get a reference to a Responder object. The function takes some optional options to configure the underlying mdns server.
The createService method of the Responder
-object can now be used to create a new CiaoService
+object can now be used to create a new CiaoService
supplying the desired configuration
-as the first parameter. You might have a look at the
+as the first parameter. You might have a look at the
restrictedAddresses
(and disableIpv6) configuration
if you don't want to advertise on all available addresses/network interfaces.
Any application SHOULD hook up a listener on events like SIGTERM or SIGINT and call the +
Any application SHOULD hook up a listener on events like SIGTERM or SIGINT and call the shutdown method of the responder object. This will ensure, that goodbye packets are sent out on all connected network interfaces and all hosts on the network get instantly notified of the shutdown. @@ -65,7 +58,7 @@
ciao
can't reliable detect modifications made to this default MTU size.
Thus , we rely on a hardcoded value, which is 1440
for the UDP Payload Size (Remember: the MTU defines the amount
-of bytes Ethernet or Wi-Fi can transport on the local link. There is additional overhead caused by the IP Header
+of bytes Ethernet or Wi-Fi can transport on the local link. There is additional overhead caused by the IP Header
and the UDP Header. So the amount of bytes we are able to fit into a single UDP packet is smaller).CIAO_UPS
environment variable.
As described in RFC 6762 15.: @@ -76,8 +69,8 @@
As the RFC also states in 15.4, it is recommended to use +
As the RFC also states in 15.4, it is recommended to use
a single mDNS implementation where possible. It is recommended to use the mdns
library where possible, as the library is pretty much a binding for existing mDNS implementations running on your
system (like mDNSResponder
on macOS or avahi
on most linux based systems).
The one downside with the mdns
library is that running it on Windows is not really straight forward.
Generally we experienced with homebridge
that many users run into problems when trying to install mdns
.
Thus bonjour-hap
and then ciao
was created to provide a much easier to set up system.
Defines the options passed to the underlying mdns server.
-Optional
disableIf specified, the mdns server will not include any ipv6 address records +
Defines the options passed to the underlying mdns server.
+Optional
disableIf specified, the mdns server will not include any ipv6 address records and not bind any udp6 sockets. This is handy if you want to "bind" on 0.0.0.0 only.
-Optional
interfaceIf specified, the mdns server will only listen on the specified interfaces (allowlist). +
Optional
interfaceIf specified, the mdns server will only listen on the specified interfaces (allowlist). It can be supplied as a string (representing a single interface) or as an array of strings to define multiple interfaces. The interface can be defined by specifying the interface name (like 'en0') or by specifying an ip address.
-Service options supplied when creating a new ciao service.
-Optional
disabledThe service won't advertise ipv6 address records. +
Service options supplied when creating a new ciao service.
+Optional
disabledThe service won't advertise ipv6 address records. This can be used to simulate binding on 0.0.0.0. May be combined with restrictedAddresses.
-Optional
domainAdds ability to set custom domain. Will default to "local". +
Optional
domainAdds ability to set custom domain. Will default to "local". The domain will also be automatically appended to the hostname.
-Optional
hostnameDefines a hostname under which the service can be reached. +
Optional
hostnameDefines a hostname under which the service can be reached. The specified hostname must not include the TLD. If undefined the service name will be used as default.
-Instance name of the service
-Optional
portPort of the service. +
Instance name of the service
+Optional
portPort of the service. If not supplied it must be set later via updatePort BEFORE advertising the service.
-Optional
protocolThe protocol the service uses. Default is TCP.
-Optional
restrictedIf defined it restricts the service to be advertised on the specified +
Optional
protocolThe protocol the service uses. Default is TCP.
+Optional
restrictedIf defined it restricts the service to be advertised on the specified ip addresses or interface names.
-If a interface name is specified, ANY address on that given interface will be advertised -(if a IP address of the given interface is also given in the array, it will be overridden). -If a IP address is specified, the service will only be advertised for the given addresses.
+If an interface name is specified, ANY address on that given interface will be advertised +(if an IP address of the given interface is also given in the array, it will be overridden). +If an IP address is specified, the service will only be advertised for the given addresses.
Interface names and addresses can be mixed in the array. If an ip address is given, the ip address must be valid at the time of service creation.
If the service is set to advertise on a given interface, though the MDNSServer is configured to ignore this interface, the service won't be advertised on the interface.
-Optional
subtypesOptional array of subtypes of the service. +
Optional
subtypesOptional array of subtypes of the service. Refer to ServiceType for some known examples.
-Optional
txtIf defined, a txt record will be published with the given service.
-Type of the service.
-Optional
txtIf defined, a txt record will be published with the given service.
+Type of the service.
+A service txt consist of multiple key=value pairs, +
A service txt consist of multiple key=value pairs, which get advertised on the network.
-This method is used to get a responder for the provided (optional) set of options.
+This method is used to get a responder for the provided (optional) set of options.
Ciao tries to create as few Responder instances as possible. Thus, it will share the same Responder instance for the same set of options.
-Optional
options: ResponderOptionsIf specified, the options will be passed to the underlying mdns server.
-A Responder instance for the given options. Might be shared with others using the same options.
-Optional
options: ResponderOptionsIf specified, the options will be passed to the underlying mdns server.
+A Responder instance for the given options. Might be shared with others using the same options.
+
The CiaoService class represents a service which can be advertised on the network.
-A service is identified by it's fully qualified domain name (FQDN), which consist of +
- Preparing search index...
- The search index is not available
@homebridge/ciao - v1.1.8Class CiaoService
The CiaoService class represents a service which can be advertised on the network.
+A service is identified by its fully qualified domain name (FQDN), which consist of the service name, the service type, the protocol and the service domain (.local by default).
The service defines a hostname and a port where the advertised service can be reached.
-Additionally a TXT record can be published, which can contain information (in form of key-value pairs), +
Additionally, a TXT record can be published, which can contain information (in form of key-value pairs), which might be useful to a querier.
A CiaoService class is always bound to a Responder and can be created using the -createService method in the Responder class. +Responder.createService method in the Responder class. Once the instance is created, advertise can be called to announce the service on the network.
-Hierarchy
--- EventEmitter
-
-- CiaoService
-
-Index
Methods
-Methods
-advertise
--- advertise(): Promise<void>
--
-
This method start the advertising process of the service:
+Hierarchy
Index
Methods
Methods
advertise
This method start the advertising process of the service:
advertiseProber could not find a unique service name while trying for a minute (timeout)- One of the announcement packets could not be sent successfully
Returns Promise<void>
destroy
--- destroy(): Promise<void>
--
-
This method must be called if you want to free the memory used by this service. +
Returns Promise<void>
destroy
This method must be called if you want to free the memory used by this service. The service instance is not usable anymore after this call.
If the service is still announced, the service will first be removed from the network by calling end.
-Returns Promise<void>
end
--- end(): Promise<void>
--
-
This method will remove the advertisement for the service on all connected network interfaces. +
Returns Promise<void>
end
This method will remove the advertisement for the service on all connected network interfaces. If the service is still in the Probing state, probing will simply be cancelled.
-Returns Promise<void>
Promise will resolve once the last goodbye packet was sent out
-getFQDN
--- getFQDN(): string
--
-
-
Returns string
The fully qualified domain name of the service, used to identify the service.
-get Hostname
--- get
Hostname(): string
--
-
-
Returns string
The current hostname of the service.
-get Lower Cased SubtypePTRs
--- get
Lower Cased SubtypePTRs(): undefined | string[]
--
-
-
Returns undefined | string[]
Array of subtype pointers (undefined if no subtypes are specified).
-get Port
--- get
Port(): number
--
-
-
Returns number
The port the service is advertising for. +
Returns Promise<void>
Promise will resolve once the last goodbye packet was sent out
+getFQDN
Returns string
The fully qualified domain name of the service, used to identify the service.
+get Hostname
Returns string
The current hostname of the service.
+get Lower Cased SubtypePTRs
Returns undefined | string[]
Array of subtype pointers (undefined if no subtypes are specified).
+get Port
Returns number
The port the service is advertising for. {@code -1} is returned when the port is not yet set.
-get TypePTR
--- get
TypePTR(): string
--
-
-
Returns string
The service type pointer.
-update Port
--- update
Port(port): void
--
-
- get
TypePTR(): string
- update
Port(port): void
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Sets or updates the port of the service. +
get TypePTR
Returns string
The service type pointer.
+update Port
Sets or updates the port of the service. A new port number can only be set when the service is still UNANNOUNCED. -Otherwise an assertion error will be thrown.
-Parameters
---
-
port: number
-The new port number.
-Returns void
update Txt
--- update
Txt(txt, silent?): void
--
-
-
-
-
Sets or updates the txt of the service.
-Parameters
---
-
--
-
txt: ServiceTxt
-The updated txt record.
-silent: boolean = false
-If set to true no announcement is sent for the updated record.
-Returns void
-
-Settings
Member Visibility
Theme
-
-On This Page
-- advertise
-- destroy
-- end
-- getFQDN
-- get
Hostname
-- get
Lower Cased SubtypePTRs
-- get
Port
-- get
TypePTR
-- update
Port
-- update
Txt
Parameters
The new port number.
+Returns void