# dnssd-advertise

> A Bonjour DNS-SD service announcer via mDNS on UDP

Latest version **1.1.6** (published 2026-06-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install dnssd-advertise
pnpm add dnssd-advertise
yarn add dnssd-advertise
bun add dnssd-advertise
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2026-06-11 |
| First published | 2026-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 260.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | Phil Pluckthun |
| Maintainers | philpl |
| Keywords | mdns, dnssd, dns-sd, bonjour, advertise, announce |

## Links

- npm: https://www.npmjs.com/package/dnssd-advertise
- Repository: https://github.com/kitten/dnssd-advertise
- Homepage: https://github.com/kitten/dnssd-advertise#readme
- Issues: https://github.com/kitten/dnssd-advertise/issues
- npm.io page: https://npm.io/package/dnssd-advertise

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.1.6 (latest) — 2026-06-11
- 1.1.6-canary-baefb67a92fe132ea5a86ba8a27020528584b8aa (canary) — 2026-06-11
- 1.1.5 — 2026-06-11
- 1.1.5-canary-93045e9d5465cb381fd5d8cdebb758bc83e29c94 — 2026-06-11
- 1.1.5-canary-5c50b0587010f80dc5ebe5666146a770d661621c — 2026-06-11
- 1.1.5-canary-fd908ba3030143fe684595a6ca5b2936c443f096 — 2026-06-11
- 1.1.4 — 2026-03-23
- 1.1.4-canary-1b228299d86fe6940328332038f5fa3724015053 — 2026-03-23
- 1.1.3 — 2026-02-06
- 1.1.3-canary-5f57f4975afe5fca8e51f38a27d3adcd04528df5 — 2026-02-06
- 1.1.2 — 2026-01-29
- 1.1.2-canary-9cc7e08bd57e555b14b789a5bed3f488d3e80d14 — 2026-01-29
- 1.1.1 — 2026-01-21
- 1.1.1-canary-f081726fa4d3b3dea2697874d42b7c461dad8da5 — 2026-01-21
- 1.1.0 — 2026-01-21
- … 19 more at https://npm.io/package/dnssd-advertise/versions

## README

# dnssd-advertise

A well-behaved Bonjour/DNS-SD service advertiser for Node.js, designed for long-running processes.

- Aims to be compliant with [RFC 6762](https://datatracker.ietf.org/doc/html/rfc6762) and [RFC 6763](https://datatracker.ietf.org/doc/html/rfc6763#section-6)
- Handles network interface changes, socket recovery, and re-announcements for long-running processes
- Supports dual-stack IPv4 and IPv6 service announcement with NIC-scoped responses
- Single dependency ([dns-message](https://github.com/kitten/dns-message) is bundled)

## Quick Reference

```javascript
import { advertise } from 'dnssd-advertise';

const stop = advertise({
  name: 'My Service',
  type: 'http',
  protocol: 'tcp',
  port: 3000,
});

process.on('exit', () => {
  stop();
});
```

### Conflict Resolution

When a conflict is detected during probing, as per the specification, the name or hostname of your service may be altered:

- When the `name` conflicts a 4-character hex ID is appended (e.g. `My Service (B0A1)`
- When the `hostname` conflicts a number is appended to it (e.g. `my-hostname-2`)

When a conflict is detected during announcing, the probing phase restarts with the same conflict resolution.

## API Reference

### `advertise(options): () => Promise<void>`

Starts advertising a DNS-SD service on all available network interfaces.

Returns a function that, when called, stops advertising and sends goodbye packets to remove the service from the network.
Stopping the advertiser is, while preferred, optional as per the mDNS specification.

#### Options

| Option     | Type                       | Description                                                        |
| ---------- | -------------------------- | ------------------------------------------------------------------ |
| `name`     | `string`                   | Instance/display name of the service (e.g., "Living Room Speaker") |
| `type`     | `string`                   | Service type without protocol (e.g., "http", "ssh", "airplay")     |
| `protocol` | `'tcp' \| 'udp'`           | Protocol used by the service                                       |
| `port`     | `number`                   | Port the service is listening on                                   |
| `hostname` | `string`                   | Hostname to advertise (defaults to system hostname)                |
| `subtypes` | `string[]`                 | Optional list of subtypes                                          |
| `txt`      | `Record<string, TxtValue>` | Optional service metadata as key-value pairs                       |
| `ttl`      | `number`                   | TTL for DNS records in seconds (defaults to 250s)                  |

---
_Source: https://npm.io/package/dnssd-advertise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
