urql-graphql / urql-devtools-exchange

The exchange for usage with Urql Devtools
https://www.npmjs.com/package/@urql/devtools
MIT License
54 stars 6 forks source link

Add platform detection and use 10.0.2.2 in Android #104

Closed bkonkle closed 4 years ago

bkonkle commented 4 years ago

Resolves FormidableLabs/urql-devtools#315

andyrichardson commented 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:

bkonkle commented 4 years ago

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.