When developing MPC functionality locally with Docker containers, the iOS simulator needs to connect to services running on your host machine. This guide explains how to configure your local environment.
-
Find your machine's IP address:
ifconfig | grep -E "inet.*broadcast" | grep -v 127.0.0.1 | awk '{print $2}' | head -1
-
Update the configuration: Edit
Interspace/Configuration/MPCLocalConfig.swift:static let hostIP = "YOUR_IP_HERE" // e.g., "192.168.2.79"
-
Ensure Docker services are running:
cd ../interspace-backend docker-compose -f docker-compose.local.yml --profile local up -d
-
Rebuild and run the iOS app
- iOS Simulator has its own network stack
localhostor127.0.0.1in the simulator refers to the simulator itself, not your Mac- Docker containers expose ports on your Mac's network interface
- The simulator needs your Mac's actual IP address to reach Docker containers
If you see "Connection refused" errors:
- Verify your IP hasn't changed (routers may assign new IPs)
- Check Docker containers are running:
docker ps - Test connectivity:
curl http://YOUR_IP:8080
- Ensure the WebSocket URL doesn't have double protocol prefixes (e.g.,
ws://ws://...) - Check sigpair logs:
docker logs interspace-sigpair-local
If you switch networks (e.g., home to office):
- Find your new IP address
- Update
MPCLocalConfig.swift - Clean build folder and rebuild
For a more permanent solution, consider:
- Using ngrok to expose local services
- Setting up a local DNS entry
- Using Docker Desktop's host.docker.internal (doesn't work for iOS)