{"id":16833141,"url":"https://github.com/balthazar/react-native-zeroconf","last_synced_at":"2025-04-05T19:14:22.271Z","repository":{"id":42233606,"uuid":"44876645","full_name":"balthazar/react-native-zeroconf","owner":"balthazar","description":":satellite: Discover Zeroconf services using react-native","archived":false,"fork":false,"pushed_at":"2024-05-05T16:49:41.000Z","size":1571,"stargazers_count":220,"open_issues_count":50,"forks_count":98,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-30T02:55:28.999Z","etag":null,"topics":["broadcast","network","react","react-native","zeroconf"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/balthazar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-24T17:25:19.000Z","updated_at":"2024-10-01T18:14:01.000Z","dependencies_parsed_at":"2024-05-05T17:44:30.782Z","dependency_job_id":"f1ff0161-9480-4481-810d-bd3d1876dc09","html_url":"https://github.com/balthazar/react-native-zeroconf","commit_stats":null,"previous_names":["apercu/react-native-zeroconf"],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balthazar%2Freact-native-zeroconf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balthazar%2Freact-native-zeroconf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balthazar%2Freact-native-zeroconf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balthazar%2Freact-native-zeroconf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/balthazar","download_url":"https://codeload.github.com/balthazar/react-native-zeroconf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386266,"owners_count":20930619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["broadcast","network","react","react-native","zeroconf"],"created_at":"2024-10-13T11:52:29.907Z","updated_at":"2025-04-05T19:14:22.215Z","avatar_url":"https://github.com/balthazar.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# react-native-zeroconf\n\n\u003e Basic Zeroconf implementation for React-native\n\nGet running services advertizing themselves using Zeroconf implementations like Avahi, Bonjour or NSD.\n\n### Install\n\n    yarn add react-native-zeroconf\n    # for react-native \u003c 0.60 only (all platforms):\n    react-native link\n    # for ios (when using CocoaPods):\n    (cd ios \u0026\u0026 pod install)\n    # for macOS (when using CocoaPods):\n    (cd macos \u0026\u0026 pod install)\n\nYou can look at [the wiki](https://github.com/Apercu/react-native-zeroconf/wiki) if you prefer a manual install.\n\nTXT records will be available on iOS and Android \u003e= 7.\n\nFor Android please ensure your manifest is requesting all necessary permissions.\n\n```xml\n\u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\n\u003cuses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" /\u003e\n\u003cuses-permission android:name=\"android.permission.CHANGE_WIFI_MULTICAST_STATE\" /\u003e\n```\n\n### Android\n\nIf you need support for Android versions prior to 12, you might want to try installing the package version `0.12.5` and below.\n\n### IOS 14 Permissions\n\nIOS 14 requires you to specify the services you want to scan for and a description for what you're using them.\n\nIn your `info.plist` add the following strings:\n```xml\n\u003ckey\u003eNSBonjourServices\u003c/key\u003e\n\t\u003carray\u003e\n\t\t\u003cstring\u003emy_service._tcp.\u003c/string\u003e\n\t\t\u003cstring\u003emy_other_service._tcp.\u003c/string\u003e\n\t\u003c/array\u003e\n\u003ckey\u003eNSLocalNetworkUsageDescription\u003c/key\u003e\n\u003cstring\u003eDescribe why you want to use local network discovery here\u003c/string\u003e\n```\n\n### Example\n\nTake a look at the [example folder](./example). Install the dependencies, run `node server.js` and launch the project.\n\n### API\n\n```javascript\nimport Zeroconf from 'react-native-zeroconf'\nconst zeroconf = new Zeroconf()\n```\n\n##### Methods\n\n###### `scan(type = 'http', protocol = 'tcp', domain = 'local.')` Start the zeroconf scan\n\nThis will initialize the scan from the `Zeroconf` instance. Will stop another scan if any is running.\n\n###### `stop()` Stop the scan\n\nIf any scan is running, stop it. Otherwise do nothing.\n\n###### `getServices()` Returns resolved services\n\nWill return all names of services that have been resolved.\n\n###### `removeDeviceListeners()` Remove listeners\n\nAllow you to clean the listeners, avoiding potential memory leaks ([#33](https://github.com/Apercu/react-native-zeroconf/issues/33)).\n\n###### `addDeviceListeners()` Add listeners\n\nIf you cleaned the listeners and need to get them back on.\n\n###### `publishService(type, protocol, domain, name, port, txt)` Publish a service\n\nThis adds a service for the current device to the discoverable services on the network.\n\n`domain` should be the domain the service is sitting on, dot suffixed, for example `'local.'`\n`type` should be both type and protocol, underscore prefixed, for example `'_http._tcp'`\n`name` should be unique to the device, often the device name\n`port` should be an integer\n`txt` should be a hash, for example `{\"foo\": \"bar\"}`\n\n###### `unpublishService(name)` Unpublish a service\n\nThis removes a service from those discoverable on the network.\n\n`name` should be the name used when publishing the service\n\n##### Events\n\n```javascript\nzeroconf.on('start', () =\u003e console.log('The scan has started.'))\n```\n\n###### `start` Triggered on scan start\n###### `stop` Triggered on scan stop\n###### `found` Triggered when a service is found\n\nBroadcast a service name as soon as it is found.\n\n###### `resolved` Triggered when a service is resolved\n\nBroadcast a service object once it is fully resolved\n\n```json\n{\n  \"host\": \"XeroxPrinter.local.\",\n  \"addresses\": [\n    \"192.168.1.23\",\n    \"fe80::aebc:123:ffff:abcd\"\n  ],\n  \"name\": \"Xerox Printer\",\n  \"fullName\": \"XeroxPrinter.local._http._tcp.\",\n  \"port\": 8080\n}\n```\n\n###### `remove` Triggered when a service is removed\n\nBroadcast a service name removed from the network.\n\n###### `update` Triggered either when a service is found or removed\n###### `error` Triggered when an error occurs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalthazar%2Freact-native-zeroconf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbalthazar%2Freact-native-zeroconf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalthazar%2Freact-native-zeroconf/lists"}