[Feature] Access emulator localhost port from LAN
Closed this issue ยท 6 comments
Instructions
Add LAN access for the emulator, so that other device from the same network can access emulator from local IP address. eg.192.168.x.x
Issue To Be Solved
Currently, when developers try to build a dapp on mobile with the local emulator.
They will need access to the local emulator from their mobile device.
At the moment, the local REST or gRPC API is only available from localhost
, not from LAN.
It has been a blocker for mobile SDK to use emulators in real mobile device.
Suggest A Solution
Flow SDK seems to use net/http
as HTTP server. I found sth could be a fix in here:
https://stackoverflow.com/questions/65985328/net-http-connection-refused-over-lan
Instead of hardcode 127.0.0.1:8888
as the address which will only be available from localhost network, we might use :8888
instead.
There is a temporary fix in here if it starts the emulator with the empty host. it will work fine with localhost
and LAN
flow emulator -f flow.json --host ""
Does setting the host to your LAN IP work?
Does setting the host to your LAN IP work?
If I set the host to my local LAN IP, It will work with local IP only, neither localhost
nor 127.0.0.1
.
I think we should keep the default host as an empty string.
it seem the when it's empty, the net/http
will be available for both 127.0.0.1
, localhost
, and LAN.
0.0.0.0 should work too, for ipV4. But also ipv6 support would be nice
0.0.0.0 should work too, for ipV4. But also ipv6 support would be nice
oh, then it's better.