I'm working on a personal project in React Native and part of it involves two devices, regardless of whether they're Android or iOS and both using this app, sending each other some data in a JSON format. To give some context, three devices (A, B and C) are connected to the same wifi network and once device A created a group, devices B and C should be able to find device A through a unique id and then send data to it. Device A, upon receiving data, will do some stuff and send a status code back.
I couldn't find questions about this related to react native, but more about Android and WifiP2P. I also found an npm packages (p2p), but being new to React Native, I'm not sure if you can use them or if they only apply to browser-related code.
Can you guys help me finding libraries to use to accomplish this?
Edit: I also found this package, but it looks like you have to invite a device to be part of a channel, rather than ask to join. Can anyone confirm if that library could work for my purposes and if there's a workaround for the issue I just described?
You can use react-native-wifi-p2p
react-native-wifi-p2p
is a library that provides WiFi
Direct (peer-to-peer) services to a react native
system.
Important: currently only Android
support realized. If you want to provide iOS support, then you should to note to react-native-multipeer repository.