Title: Published ZeroConf Services are not Discoverable on Android React Native But Visible in Bonjour Browser. · Issue #1387 · python-zeroconf/python-zeroconf · GitHub
Open Graph Title: Published ZeroConf Services are not Discoverable on Android React Native But Visible in Bonjour Browser. · Issue #1387 · python-zeroconf/python-zeroconf
X Title: Published ZeroConf Services are not Discoverable on Android React Native But Visible in Bonjour Browser. · Issue #1387 · python-zeroconf/python-zeroconf
Description: Hello Team, I am a University Student and Working on My Dissertation, I was exploring some libraries to connect to RPi's local Node/Python server. I am using python to publish a zeroconf service on local network on RPi 4 Model B from zer...
Open Graph Description: Hello Team, I am a University Student and Working on My Dissertation, I was exploring some libraries to connect to RPi's local Node/Python server. I am using python to publish a zeroconf service on...
X Description: Hello Team, I am a University Student and Working on My Dissertation, I was exploring some libraries to connect to RPi's local Node/Python server. I am using python to publish a zeroconf servic...
Opengraph URL: https://github.com/python-zeroconf/python-zeroconf/issues/1387
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Published ZeroConf Services are not Discoverable on Android React Native But Visible in Bonjour Browser.","articleBody":"Hello Team,\r\nI am a University Student and Working on My Dissertation, I was exploring some libraries to connect to RPi's local Node/Python server. \r\n\r\nI am using python to publish a zeroconf service on local network on RPi 4 Model B\r\n\r\n``` py\r\nfrom zeroconf import ServiceInfo, Zeroconf\r\n\r\nPORT=8080\r\n\r\nzeroconf = Zeroconf()\r\nwsInfo = ServiceInfo('_http._tcp.local.',\r\n \"myhost._http._tcp.local.\",\r\n PORT, 0, 0, {\"random_key\": \"1234\", \"answer\": \"42\"})\r\nzeroconf.register_service(wsInfo)\r\n\r\nimport time\r\ntime.sleep(1000);\r\n```\r\n\r\n\r\nAfter Registering this service, It is visible on the Bonjour Browser. \r\nMy Host is the service name.\r\nbut the same is not visible in the react native app using react-native-zeroconf.\r\n\r\n\r\n\r\nReact Native Code\r\n\r\n```ts\r\n/**\r\n * Sample React Native App\r\n * https://github.com/facebook/react-native\r\n *\r\n * @format\r\n */\r\n\r\nimport React, {useEffect} from 'react';\r\nimport {\r\n SafeAreaView,\r\n ScrollView,\r\n StatusBar,\r\n Text,\r\n useColorScheme,\r\n View,\r\n} from 'react-native';\r\nimport Zeroconf from 'react-native-zeroconf';\r\nimport {Colors} from 'react-native/Libraries/NewAppScreen';\r\n\r\nconst zeroconf = new Zeroconf();\r\n\r\nfunction App(): React.JSX.Element {\r\n const isDarkMode = useColorScheme() === 'dark';\r\n\r\n const backgroundStyle = {\r\n backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,\r\n };\r\n\r\n useEffect(() =\u003e {\r\n const handleStart = () =\u003e console.log('The scan has started.');\r\n const handleFound = name =\u003e console.log('Service found:', name);\r\n const handleResolved = service =\u003e {\r\n console.log('Service resolved:', service);\r\n // setServices(prevServices =\u003e [...prevServices, service]);\r\n };\r\n const handleError = err =\u003e console.log('Error:', err);\r\n const handleStop = () =\u003e console.log('The scan has stopped.');\r\n\r\n zeroconf.on('start', handleStart);\r\n zeroconf.on('found', handleFound);\r\n zeroconf.on('resolved', handleResolved);\r\n zeroconf.on('error', handleError);\r\n zeroconf.on('stop', handleStop);\r\n\r\n // Start the service scan\r\n setTimeout(() =\u003e {\r\n zeroconf.scan('http', 'tcp');\r\n console.log('Started scanning...');\r\n }, 1000);\r\n\r\n // Cleanup on component unmount\r\n return () =\u003e {\r\n zeroconf.off('start', handleStart);\r\n zeroconf.off('found', handleFound);\r\n zeroconf.off('resolved', handleResolved);\r\n zeroconf.off('error', handleError);\r\n zeroconf.off('stop', handleStop);\r\n zeroconf.stop();\r\n };\r\n }, []);\r\n\r\n return (\r\n \u003cSafeAreaView style={backgroundStyle}\u003e\r\n \u003cStatusBar\r\n barStyle={isDarkMode ? 'light-content' : 'dark-content'}\r\n backgroundColor={backgroundStyle.backgroundColor}\r\n /\u003e\r\n \u003cScrollView\r\n contentInsetAdjustmentBehavior=\"automatic\"\r\n style={backgroundStyle}\u003e\r\n \u003cView\u003e\r\n \u003cText\u003eMy Better RN NETWORK\u003c/Text\u003e\r\n \u003c/View\u003e\r\n \u003c/ScrollView\u003e\r\n \u003c/SafeAreaView\u003e\r\n );\r\n}\r\n\r\nexport default App;\r\n\r\n```\r\n\r\nMy WiFi Router's Services are visible in the console but not this one.\r\n\r\n\r\n\r\n\r\nCan someone please help me making my zeroconf service discoverable in react native code....\r\nThe same is True with nodejs server usng 'bonjour' package.\r\n\r\nI have added these permissions in AndroidManifest.xml\r\n\r\n```xml\r\n \u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\r\n \u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\r\n \u003cuses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" /\u003e\r\n \u003cuses-permission android:name=\"android.permission.CHANGE_WIFI_MULTICAST_STATE\" /\u003e\r\n```\r\n\r\n@bdraco @PaarthShah @jstasiak @scop @dtantsur @andrewbonney @","author":{"url":"https://github.com/Tauqeer-Ahmed-99","@type":"Person","name":"Tauqeer-Ahmed-99"},"datePublished":"2024-08-07T17:51:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/1387/python-zeroconf/issues/1387"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fc05b615-9a34-3466-bad1-f550967910f7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C802:2F44D6:903B5E:CB6152:697250F9 |
| html-safe-nonce | 0c1e6fb1f0ac0f13cfc13c667c064c2ad3f464724d684c6048d9fa4c0e8e2568 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODAyOjJGNDRENjo5MDNCNUU6Q0I2MTUyOjY5NzI1MEY5IiwidmlzaXRvcl9pZCI6IjIyMDc3MDA1NDI5NTc5NjU1NjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0063f7b52882c75e37daa2dc53c129c4415edb03ea7d20e8c0fc441547ae2027 |
| hovercard-subject-tag | issue:2454018591 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-zeroconf/python-zeroconf/1387/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3f3a6f67a08ca1b4916028bdc488b1045e40eb744b4cd2d53615153d3360be08/python-zeroconf/python-zeroconf/issues/1387 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3f3a6f67a08ca1b4916028bdc488b1045e40eb744b4cd2d53615153d3360be08/python-zeroconf/python-zeroconf/issues/1387 |
| og:image:alt | Hello Team, I am a University Student and Working on My Dissertation, I was exploring some libraries to connect to RPi's local Node/Python server. I am using python to publish a zeroconf service on... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Tauqeer-Ahmed-99 |
| hostname | github.com |
| expected-hostname | github.com |
| None | f6d9b08324bb62b2cf170b9e435da2bdc7efa5aa93e7ca70ee3162552c05329b |
| turbo-cache-control | no-preview |
| go-import | github.com/python-zeroconf/python-zeroconf git https://github.com/python-zeroconf/python-zeroconf.git |
| octolytics-dimension-user_id | 120192235 |
| octolytics-dimension-user_login | python-zeroconf |
| octolytics-dimension-repository_id | 21548731 |
| octolytics-dimension-repository_nwo | python-zeroconf/python-zeroconf |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 21548731 |
| octolytics-dimension-repository_network_root_nwo | python-zeroconf/python-zeroconf |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 169d2b5c72bff9cc676084f0ac7f8ea888f15f54 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width