inProgress-team / react-native-meteor

Meteor Reactivity for your React Native application :)
MIT License
693 stars 210 forks source link

Not working with Exponent #196

Open gwendall opened 7 years ago

gwendall commented 7 years ago

I get a Disconnected from DDP server whenever I try to Meteor.connect to a Meteor back-end from an Exponent-built app. Anyone else ?

maadoche commented 7 years ago

This works fine for me and you only need to connect once. Are you using the correct IP to connect to the server?

noris666 commented 7 years ago

@gwendall Which platform you use ?

JulianKingman commented 7 years ago

Works for me too, post code?

jmaguirrei commented 7 years ago

Same problem here, I am using Meteor.connect('ws://localhost:3000/websocket'); and I get the same message. Do I need a different IP?

JulianKingman commented 7 years ago

Are you running it in the simulator, or phone?

jmaguirrei commented 7 years ago

In an iPhone. After a few tests, the only way I could make it work was using my IP address of my wireless network in the connection, but only works when my phone is actually connected to that network. I think the other path is to SSH my localhost and then tell Meteor to use that in the server?

For developing purposes I can rely in mi Wifi network, but when in testing, I will need to test it under 3g/4g connections, to my localhost running or maybe to Galaxy.

Any ideas on it are welcome. This is the first time I face this aspect in the development.

rdickert commented 7 years ago

You can try ngrok to run from localhost remotely to demo or test (I don't use it myself, so I can't speak to its usefulness, but I remember someone said it was good, and it does support websockets). Of course, you should do tests against a real server (Galaxy or whatever) when you can.

JulianKingman commented 7 years ago

@jmaguirrei That's pretty much expected. Localhost (from the iPhone's point of view), would point to the iPhone itself, which is not where the meteor instance is running. I think you can get around this by using exponent, but you have to make sure your app is compatible. You'll also still need to be on the same network. For your purposes, it sounds like it would be best to have a server to test against. If cost is an issue, you might be able to get this working: https://medium.com/@purplecones/deploying-a-meteor-app-for-free-using-zeit-now-c183329057c9#.1q2wye72t

JulianKingman commented 7 years ago

BTW, the "Network Link Conditioner" prefPane is super handy for testing network connectivity, it's on the apple website somewhere.

jmaguirrei commented 7 years ago

@JulianKingman Thanks, nice to have a place to run Meteor apps for free. I use Ubuntu (because of that I also use Exponent), so the "Network Link Conditioner" is not an option for me, only for developing on a Mac, am I right?

JulianKingman commented 7 years ago

Ah, yes. I assumed you were on a mac. There's probably something similar, though. There's a commandline tool built in: https://wiki.linuxfoundation.org/networking/netem

jmaguirrei commented 7 years ago

@JulianKingman, Thanks.

RobAWilkinson commented 7 years ago

Also, I was having problems with this until I made sure to ping my meteor server every once in a while in another browser tab.