inProgress-team / react-native-meteor

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

Meteor.status().status always connected #277

Open pricetula opened 7 years ago

pricetula commented 7 years ago

Meteor.status().status always remains as connected i expected it to go offline when there is no internet connection. Is there a work around to detect connection to server

mgscreativa commented 7 years ago

I think I figured it out like this:

    Meteor.ddp.on('connected', () => {
      console.info('Connected to DDP server.');
    });

    Meteor.ddp.on('disconnected', () => {
      console.info('Connection to DDP server lost.');
    });

Another way may be to use RN NetInfo package like this NetInfo.addEventListener('change', (info) => { clever logic to handle network changed status } );