BonjourBrowser


super: BaseDataSet

A network service browser that finds published services on a network using multicast DNS.

Events

  • Load() This event is called when the object becames available in the current runtime system.

  • DidFindService(bonjourService: BonjourService) Event raised when a searchForServices() request finds a service.

  • DidRemoveService(bonjourService: BonjourService) Event raised when a service has disappeared or has become unavailable during the execution of a searchForServices() search.

  • DidFail(error: Map) Event raised when a searchForServices() request fails.

  • DidStart() Event raised when DataSet started retrieving data.

  • NewValue(value: Object) Event raised when a new value becomes available.

  • DidFinish() Event raised when DataSet finished retrieving data.

  • Unload() This event is called when the object has been removed from the current runtime system (but not yet deallocated).

Properties

  • var resolveTimeout: Float The maximum number of seconds to attempt to resolve the address for a given service. A value of 0.0 indicates no timeout and a resolve process of indefinite duration.

  • var domain: String Default domain name in which to perform a searchForServices() request if the domainName parameter is not specified. The domainName argument can be an explicit domain name, the generic local domain "local." (note trailing period, which indicates an absolute name), or the empty string (@), which indicates the default registration domains. Usually, you pass in an empty string.

  • var serviceType: String Default service type used when performing a searchForServices() request if the serviceType parameter is not specified. The serviceType must contain both the service type and transport layer information. To ensure that the mDNS responder searches for services, rather than hosts, make sure to prefix both the service name and transport layer name with an underscore character (“_”). For example, to search for an HTTP service on TCP, you would use the type string “_http._tcp.“. Note that the period character at the end is required.

  • var discoveredServices: List List of discovered network services. (read-only)

Methods

  • func searchForDomains(didFindDomain: Closure = null, didRemoveDomain: Closure = null, onError: Closure = null) Initiates a search for domains visible to the host.

  • func searchForServices(serviceType: String = null, domainName: String = null, didFindService: Closure = null, didRemoveService: Closure = null, onError: Closure = null) Starts a search for services of a particular type within a specific domain. The serviceType parameter defines the type of service to search for, if empty the BonjourBrowser uses the value from the inspector. The serviceType argument must contain both the service type and transport layer information. To ensure that the mDNS responder searches for services, rather than hosts, make sure to prefix both the service name and transport layer name with an underscore character (“_”). For example, to search for an HTTP service on TCP, you would use the type string “_http._tcp.“. Note that the period character at the end is required. The domainName parameter defines the domain in which to perform the search, if empty the BonjourBrowser uses the value from the inspector. The domainName argument can be an explicit domain name, the generic local domain "local." (note trailing period, which indicates an absolute name), or the empty string (@), which indicates the default registration domains. Usually, you pass in an empty string. The optional didFindService closures is executed when the BonjourBrowser found a service; this closure is invoked with one arguments: the discovered BonjourService object. The optional paramDidRemoveService closures is executed when a service has disappeared or has become unavailable; it is invoked with one arguments: the disappeared BonjourService object. The optional paramOnError closures is executed when a search fails; it is invoked with one arguments: a map with the details of the error.

  • func stop() Halts a currently running search or resolution.