how to allow mobile apps to communicate without a separate server

I am designing a mobile app that will allow users to contribute to a collective list of items (bascially just strings). Some of those items will then be displayed on the users’ devices, but not the same items for each user. This app is designed to be used locally as a social activity, with users all running the same app, in the same physical room, and on the same Wifi network.

For an example of an app that works in a similar fashion, see the SpaceTeam app, a game in which players are given instructions on their screens that correspond to controls on another player’s screen. In SpaceTeam, the list of instrucitons is not contributed by the players, but there is nonetheless a finite list of valid instructions, which is co-ordinated between the devices currently playing (and this is done, to my knowledge, between the players’ devices without a separate external server).

My current design approach is that one of the devices will assign itself as the host, will maintain the complete list of contributed items, accept additions from other users (clients), and assign the items back to the other users.

I am using React Native, as I wish my app to support iOS as well as Android, but any open and cross-platform mobile app framework would be acceptable if it allows me to achieve the goal.

I could be on the wrong path, but socket.io looks like it might provide the soort of high-level comminucation API I’m looking for.

I have found countless tutorials on how to handle communication between apps, such as tutorials on creating messaging or video calling apps, but in all these cases, a separate server (usually a node.js server) is required, running externally to the app (usually on the developer’s machine). I think this means I’d need to keep a server running for the app to function, and I don’t want to have to provide and maintain that resource.

I would prefer that the apps can handle communication between them, ‘peer-to-peer’, so to say. I would be fine to have one of the apps spin up a server actually on the mobile device, and have the other apps connect to it, but I’ve not found instructions on how to do that. Alternatively, perhaps there’s another way to allow apps to communicate simply on the local network?

Can anyone provide a combination of tools that would allow me to put this sort of inter-app communication together without writing large amounts of the network handling code myself? I’m happy to design the types of messages that are passed and how they are handled, but I’m hoping there’s a cross-platform library for linking the devices together and sending/receiving the messages.

If your motivation for avoiding a server is to avoid cost – you can very easily manage a free-tier of Firebase or Supabase for a simple to-do list manager. Take a look at the Firebase Firestore as a starting point. That is what I would do in your situation, you can get A LOT out of the free tier of Firebase these days. We have also used Supabase quite a lot as well in recent projects.

If you’d still like to explore the peer-to-peer direction you can have a look at react-native-webrtc, they have a sample React Native app in their repo as well. One of the challenges with peer-to-peer connectivity is that there are a lot of platform-specific APIs/solutions that are iOS-only or Android-only, so you are kind of limited if you want a one-size-fits-all solution written in React Native. WebRTC could be one to explore that works for both platforms.

Leave a Comment