chrome.mdns

Description: Use the chrome.mdns API to discover services over mDNS. This comprises a subset of the features of the NSD spec: http://www.w3.org/TR/discovery-api/
Availability: Since Chrome 31.
Permissions: "mdns"

Summary

Properties
MAX_SERVICE_INSTANCES_PER_EVENT
Methods
forceDiscovery chrome.mdns.forceDiscovery(function callback)
Events
onServiceList

Properties

2,048 chrome.mdns.MAX_SERVICE_INSTANCES_PER_EVENT

Since Chrome 44.

The maximum number of service instances that will be included in onServiceList events. If more instances are available, they may be truncated from the onServiceList event.

Methods

forceDiscovery

chrome.mdns.forceDiscovery(function callback)

Since Chrome 45.

Immediately issues a multicast DNS query for all service types. |callback| is invoked immediately. At a later time, queries will be sent, and any service events will be fired.

Parameters
function callback

Callback invoked after ForceDiscovery() has started.

The callback parameter should be a function that looks like this:

function() {...};

Events

onServiceList

Event fired to inform clients of the current complete set of known available services. Clients should only need to store the list from the most recent event. The service type that the extension is interested in discovering should be specified as the event filter with the 'serviceType' key. Not specifying an event filter will not start any discovery listeners.

addListener

chrome.mdns.onServiceList.addListener(function callback)
Parameters
function callback

The callback parameter should be a function that looks like this:

function(array of object services) {...};
array of object services

Properties of each object

string serviceName

The service name of an mDNS advertised service, ..

string serviceHostPort

The host:port pair of an mDNS advertised service.

string ipAddress

The IP address of an mDNS advertised service.

array of string serviceData

Metadata for an mDNS advertised service.