Skip to content
Balthazar edited this page Oct 4, 2026 · 11 revisions

react-native-zeroconf

Discover and publish network services on the local network with Zeroconf (Bonjour, Avahi, mDNS) from React Native, on iOS, macOS, tvOS, Android and Windows.

import Zeroconf from 'react-native-zeroconf'

const zeroconf = new Zeroconf()
zeroconf.on('resolved', service => console.log(service.name, service.addresses, service.port))
zeroconf.scan({ type: 'http' })

Documentation for 0.17. Upgrading from an earlier version? Read the Migration Guide.

1.0 release candidate: one C++ native module on every platform, for React Native 0.82 and later (New Architecture, Expo SDK 55 and later). Try it with npm install react-native-zeroconf@next, see what changes from 0.17. These docs cover 0.17, which stays the default and keeps getting bug fixes.

Start here

If you want to... Read
Add the library to a React Native or Expo app Installation
Configure Info.plist, Local Network access and Android permissions Permissions and Setup
Scan for services and read what they resolve to Scanning
Advertise your own services and TXT records Publishing
Use the useZeroconf hook and clean up in components React Integration
Tell errors apart and react to them Error Handling
Look up a method, option or event API Reference
Look up an error code or domain Errors
Choose between NSD and DNSSD on Android Android Implementations
Test on the Android emulator Android Emulator
Fix "nothing is found", -65555 / -65570, Expo Go crashes... Troubleshooting and FAQ
Upgrade from an earlier version Migration Guide
Check what each platform supports Platform Support
Build the library and the example app Contributing

At a glance

  • React hook: useZeroconf() scans while a component is mounted and returns the resolved services.
  • Discovery: scan() emits found, then resolved with host, port, addresses (IPv4 first) and TXT records.
  • Multiple scans: each Zeroconf instance (and each useZeroconf hook) runs its own scan, so several service types can be browsed at once.
  • Service types: scanServiceTypes() lists the service types advertised on the network (Android, or iOS with the multicast entitlement).
  • Live updates: resolved fires again when a service's addresses or TXT record change.
  • Subtypes and interfaces: scan or publish subtypes, and pick a network interface.
  • Single services: resolveService() reaches a known service by name, updateService() changes a published TXT record.
  • Publishing: publishService() returns a promise with the service as advertised (its name can be renamed on conflict).
  • Structured errors: every error carries code, domain and, when relevant, serviceName.
  • Local Network permission: checkLocalNetworkAccess() checks iOS Local Network access and the Android 17 ACCESS_LOCAL_NETWORK permission.
  • Two Android backends: the system NsdManager (NSD, default) or an embedded mDNSResponder (DNSSD).
  • TypeScript: type definitions ship with the package.

Links

Clone this wiki locally