centrifugal / centrifuge-dart

Dart (Flutter) client SDK for bidirectional communication with Centrifugo and Centrifuge-based server over WebSocket
https://pub.dartlang.org/packages/centrifuge
MIT License
110 stars 34 forks source link

Physical device and localhost:8000 #12

Closed ghost closed 5 years ago

ghost commented 5 years ago

Anyone got an easy way to make the sample app running on my physical Nexus 5x find the localhost:8000 on my laptop over USB ?

I have my nexus 5x being used to test Chat but it of course cant find 127.0.0.1 or localhost to read the server on my laptop.

Got 2 ideas:

  1. Use Intlets ( which is like ngrok) and use a public cloud proxy that points all the way down to the local laptop and then the gateway points it to the Server. Thats a bigger project.
  2. No idea except some stuff about USB tethering on the internet. Looks like i
ghost commented 5 years ago

So this gets me the Ip of my laptop and the android is on the same wifi network.

ifconfig | grep "inet " | grep -v 127.0.0.1
        inet 192.168.2.104 netmask 0xffffff00 broadcast 192.168.2.255

But there must be a way of setting host file for android to redirect all localhost calls to 192.168.2.104 ?

ghost commented 5 years ago

for now just using ngrok.

Will change over to inlet when i get time. https://github.com/alexellis/inlets