meteorrn / meteor-react-native

Meteor client for React Native matching Meteor Spec
https://guide.meteor.com/react-native.html
Other
59 stars 31 forks source link

Stomp protocol fallback? #19

Closed allenfuller closed 4 years ago

allenfuller commented 4 years ago

I am working on a React Native app for an existing Meteor app and am finding it a challenge to authenticate. The Meteor site itself has an issue with websockets and falls back to XHR / stomp protocol for the default connection. Generally, could that be the reason I keep getting the Disconnected from DDP server. message? If not I'll continue researching. Thanks!

TheRealNate commented 4 years ago

Hi @allenfuller, typically, you'll see the repeating Disconnected message due to issues establishing the websocket connection. Usually it's because of one of two issues:

  1. The url is in the wrong format. Make sure your url follows the format ws:// or wss:// + your app's domain + /websocket, for example: wss://yourapp.meteor.com/websocket
  2. The device isn't connected to the internet. You can use the @react-native-community/netinfo package to ensure the device is connected

If you have to use XHR/Stomp to connect to your server, this package probably won't provide much use to you since everything depends on the websocket connection. React Native provides an implementation for both fetch and XHR, but I hope we can resolve your issue connecting to your server.

allenfuller commented 4 years ago

Thanks for the feedback @TheRealNate! I was able to get the websocket issue resolved on the server (running Meteor & GraphQL subscriptions to the same server). So now React Native is working like a charm! Thanks!