inProgress-team / react-native-meteor

Meteor Reactivity for your React Native application :)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't connect to local server using real device

actooalizame opened this issue · comments

Hi,

I'm running two apps that both have the same issue.

I can connect successfully to a remote server using
Meteor.connect('ws://myapp.meteorapp.com/websocket');

But once I try to connect to my local development server using
Meteor.connect('ws://192.168.0.180:3000/websocket');

No connection data gets delivered, and the console states "ddp server disconnected".

I'm sure i'm connecting both the Android phone and my pc to the same Wifi, and that the IP i'm using is the correct IP (same used by ReactNative's dependency graph, which works fine).

Anyone else facing this issue?
It was working fine on another venue I worked on this... Could be somewhat router-related?

react-native-cli: 2.0.1
react-native: 0.55.4
Meteor 1.8.1

Hope to read some informed thoughts.
Thanks

I too am running into a similar issue. I'm running RN 0.59.10.

I can connect to the server in development/debug mode, but once it's deployed to production; it doesn't connect to the server.

Strange caveat though: I found that if you connect through a much older device (Like an s5 in my case), it connects with no problems.

@actooalizame for development server, did you check your phone is running on the same LAN network as the server?

I tried connecting to another WiFi network without success. However, I then went to yet another place to try and connect to that LAN... and voilá, it connected with no problems whatsoever.

All this was using the same Android phone and the same PC, every time.

Strange behaviour indeed.
Maybe something to do with the router configuration itself?

@actooalizame that is weird. So far I have been using expo with a tunnel connection. I will say a public IP address works better than LAN.

@actooalizame that is weird. So far I have been using expo with a tunnel connection. I will say a public IP address works better than LAN.

So the plugin accepts something like this for connecting to a local server? ----> Meteor.connect('ws://190.145.161.231:3000/websocket'); (Where 190.145.161.231 is supposedly my machine's public IP)

Or only Meteor.connect('ws://192.168.0.15:3000/websocket'); ?

Thanks for replying

@actooalizame Yes, my connection string is always like that. When I deploy to galaxy, I have set up my domain name with https, so its like wss://myname.com/websocket but any other time for dev its always like ws://54.226.211.240:8080/websocket

double check that your pc accepts incoming request with your localhost

This was really hard debugging, just solved my by deactivating public firewall in my windows machine

This was really hard debugging, just solved my by deactivating public firewall in my windows machine

This was what I found to be the case too.
Must be something to do with the specific RN version I was using on the project, which is now on RN 0.61 , and without any issues.