Closed bkonkle closed 4 years ago
10.0.2.2
is the default host IP when using a NAT (maybe others too?) in Virtualbox so this makes sense.
This wouldn't work for physical devices (plugged in via USB) however and might break cases where loopback over ADB is being used 🤔
Edit: Looked into this a little more - I think the way to go might be to make host+port configurable and then add some docs with references to either:
The best way to solve this issue seems to be using reverse port forwarding with the adb
utility:
adb reverse tcp:7700 tcp:7700
This forwards port 7700 on the emulated device to port 7700 on the host machine, allowing the app to connect to the Electron instance on the local machine.
I'm going to close this PR in favor of that solution.
Resolves FormidableLabs/urql-devtools#315
localhost
refers to the emulated device itself. There is a special alias to reach the host machine -10.0.2.2
.Platform
and determine if the special Android10.0.2.2
host should be used based on theOS
property.