This Val Town project provides a robust service to help a React Native mobile app discover and connect to a restaurant server running on a desktop application, even when network conditions are challenging.
Problem Solved
In a restaurant management system where:
A desktop application runs the server with APIs
A React Native mobile app needs to connect to those APIs
The server's IP address might change or be difficult to determine
The mobile app and server might be on different networks
This service acts as a bridge that allows the server to register its current IP addresses and the mobile app to discover and test connectivity to the server.
How It Works
Server Registration: When the desktop server starts, it sends both its local and public IP addresses to this service
Mobile App Discovery: The mobile app queries this service to get the latest server IP addresses
Connectivity Testing: The mobile app tests connectivity to both the local and public IPs to determine which one works
Direct Connection: The mobile app then connects directly to the server using the working IP