{"id":25629422,"url":"https://github.com/RichardRNStudio/react-native-find-local-devices","last_synced_at":"2025-02-22T19:17:42.011Z","repository":{"id":55506712,"uuid":"307791759","full_name":"RichardRNStudio/react-native-find-local-devices","owner":"RichardRNStudio","description":"This package loads all of the local devices for react native","archived":false,"fork":false,"pushed_at":"2024-11-11T08:02:14.000Z","size":80951,"stargazers_count":36,"open_issues_count":8,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-11T23:43:19.267Z","etag":null,"topics":["android","local-network","network-discovery","portscanning","react-native","websocket-connection"],"latest_commit_sha":null,"homepage":"","language":"Objective-C++","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/RichardRNStudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-10-27T18:24:20.000Z","updated_at":"2025-01-22T01:16:27.000Z","dependencies_parsed_at":"2024-10-31T08:35:40.270Z","dependency_job_id":null,"html_url":"https://github.com/RichardRNStudio/react-native-find-local-devices","commit_stats":null,"previous_names":["richardrnstudio/react-native-local-devices"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RichardRNStudio%2Freact-native-find-local-devices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RichardRNStudio%2Freact-native-find-local-devices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RichardRNStudio%2Freact-native-find-local-devices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RichardRNStudio%2Freact-native-find-local-devices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RichardRNStudio","download_url":"https://codeload.github.com/RichardRNStudio/react-native-find-local-devices/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240222472,"owners_count":19767461,"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":["android","local-network","network-discovery","portscanning","react-native","websocket-connection"],"created_at":"2025-02-22T19:17:20.886Z","updated_at":"2025-02-22T19:17:41.988Z","avatar_url":"https://github.com/RichardRNStudio.png","language":"Objective-C++","funding_links":[],"categories":["Objective-C++"],"sub_categories":[],"readme":"\u003ch1\u003e🚀 react-native-find-local-devices\u003c/h1\u003e\n\n[![npm version](https://img.shields.io/npm/v/react-native-find-local-devices.svg)](https://www.npmjs.com/package/react-native-find-local-devices)\n[![build](https://github.com/RichardRNStudio/react-native-find-local-devices/actions/workflows/build-app.yml/badge.svg?branch=main)](https://github.com/RichardRNStudio/react-native-find-local-devices/actions/workflows/build-app.yml)\n[![platform](https://img.shields.io/badge/platform-Android-yellow)](https://github.com/RichardRNStudio/react-native-find-local-devices)\n[![NPM total downloads](https://img.shields.io/npm/d18m/react-native-find-local-devices.svg?style=flat)](https://npmcharts.com/compare/react-native-find-local-devices?minimal=true)\n[![react-native-find-local-devices](https://snyk.io/advisor/npm-package/react-native-find-local-devices/badge.svg)](https://snyk.io/advisor/npm-package/react-native-find-local-devices)\n[![license](https://img.shields.io/badge/license-MIT-green)](https://github.com/RichardRNStudio/react-native-find-local-devices/blob/main/LICENSE)\n\n\n\u003cp align=\"center\"\u003e\n  It can be helpful when you try to get a list of your local devices over WiFi when the devices includes at least one websocket connection.\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/RichardRNStudio/react-native-find-local-devices/\"\u003e\n    \u003cimg src=\"https://github.com/RichardRNStudio/react-native-find-local-devices/blob/main/docs/android-example.gif?raw=true\" height=\"450\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp\u003eThis package allows you detect all devices over your local network with websocket connection.\u003c/p\u003e\n\u003cp\u003eYou've to add a timeout and an array of ports as parameters. The package will try to create a connection with those ports and return the ip addresses which have successful connection.\u003c/p\u003e\n\u003cp\u003eNOTICE: It doesn't work with IOS yet. Related ticket: \u003ca href=\"https://github.com/RichardRNStudio/react-native-find-local-devices/issues/2\"\u003eIOS support ticket\u003c/a\u003e\u003c/p\u003e\n\n\u003ch2\u003eInstallation\u003c/h2\u003e\n\n```sh\nyarn add react-native-find-local-devices\n```\n\nor\n\n```sh\nnpm install react-native-find-local-devices --save\n```\n\n\n\u003ch2\u003eRunning the example project\u003c/h2\u003e\n\nAndroid\n```sh\nyarn example android\n```\n\n\u003ch2\u003eUsage\u003c/h2\u003e\n\n```ts\nimport PortScanner from 'react-native-find-local-devices';\n\nconst scanner = new PortScanner({\n    timeout: 40,\n    ports: [8000],\n    onDeviceFound: (device) =\u003e {\n      console.log('Found device!', device);\n    },\n    onFinish: (devices) =\u003e {\n      console.log('Finished , devices:', devices);\n    },\n    onCheck: (device) =\u003e {\n      console.log('Checking IP: ', device.ipAddress);\n    },\n    onNoDevices: () =\u003e {\n      console.log('Finished scanning, no results have been found!');\n    },\n    onError: (error) =\u003e {\n      // Called when no service found\n      console.log('Error', error);\n    },\n  });\n\n  // You can start the discovering with the following function:\n  scanner.start();\n\n  // When the discovering is running, you can cancel that with the following function:\n  scanner.stop();\n\n```\n\nAdvanced example with state management: https://github.com/RichardRNStudio/react-native-find-local-devices/blob/main/example/src/App.tsx\n\n\u003ch2\u003eProperties of \u003ca href=\"https://github.com/RichardRNStudio/react-native-find-local-devices/blob/main/src/interfaces/IPortScanner.interface.tsx\"\u003ePortScanner\u003c/a\u003e class\u003c/h2\u003e\n\n| Name                         | Type     | Default value                         | Description                                                                                  |\n| ---------------------------- | -------- | ------------------------------------- | -------------------------------------------------------------------------------------------- |\n| `ports`                      | number[] | none, required                        | Array of port numbers.                                                                       |\n| `timeout`                    | number   | 40                                    | Timeout in millisecond to skip a specific device when it does not respond.                  |\n| `onDeviceFound`              | function | none                                  | Callback function to handle moment when a new device has been found.                         |\n| `onFinish`                   | function | none                                  | Callback function to get all of devices which have been found during the progress.                                   |\n| `onCheck`                    | function | none                                  | Callback function to responds the currently checked device's parameters.                     |\n| `onNoDevices`                | function | none                                  | Callback function to notify, scanning has been finished, no results have been found.              |\n| `onError`                    | function | none                                  | Callback function to responds any errors during the scanning.                                |\n\n\u003ch2\u003eContributing\u003c/h2\u003e\n\nSee the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.\n\n\u003ch2\u003eLicense\u003c/h2\u003e\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRichardRNStudio%2Freact-native-find-local-devices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRichardRNStudio%2Freact-native-find-local-devices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRichardRNStudio%2Freact-native-find-local-devices/lists"}