Welcome What's new in Chrome extensions API reference Samples
Welcome What's new in Chrome extensions API reference Samples

chrome.mdns

This API is part of the Chrome Apps platform, which was deprecated in 2020. It remains supported for Enterprise and Education customers on ChromeOS until at least Jan 2025. Learn more about migrating your app.
  • 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/

  • Permissions
    mdns
  • Availability
    Chrome 43+

Summary

Types

MDnsService

Properties

  • ipAddress

    string

    The IP address of an mDNS advertised service.

  • serviceData

    string[]

    Metadata for an mDNS advertised service.

  • serviceHostPort

    string

    The host:port pair of an mDNS advertised service.

  • serviceName

    string

    The service name of an mDNS advertised service, ..

Properties

MAX_SERVICE_INSTANCES_PER_EVENT

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.

Value

2048

Methods

forceDiscovery

chrome.mdns.forceDiscovery(
  callback?: function,
)
Promise 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

  • callback

    function optional

    The callback parameter looks like: () => void

Returns

  • Promise<void>

    Chrome 96+

    Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback.

Events

onServiceList

chrome.mdns.onServiceList.addListener(
  callback: function,
)

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.

Parameters

This site uses cookies to deliver and enhance the quality of its services and to analyze traffic. If you agree, cookies are also used to serve advertising and to personalize the content and advertisements that you see. Learn more about our use of cookies.