Cordova android-device continuously disconnect / reconnect


#1

I have been working on an offline app with ground:db, but I have an issue with cordova where the dpp connection is completely unstable.

Here is a simple example:

seyan:meteor_publish_test deeeed$ cat both.js 
import { Meteor } from 'meteor/meteor';

Test = new Meteor.Collection("test");

if(Meteor.isServer) {
  Meteor.publish("test", () => {
    let cursor = Test.find();
    console.log("publish cursor for test ");
    return cursor;
  });
}

if(Meteor.isClient) {

  Tracker.autorun(() => {
    console.debug("connected: "+Meteor.status().connected);
  });

  Meteor.subscribe("test");
}
seyan:meteor_publish_test deeeed$ 

As you can see on the screenshot, it keeps disconnecting and re-subscribing to the publication.
It is a big problem for me as I have a lot of data to load for an offline app, and I would like to limit the size of the data being transfered…

It doesn’t happen on desktop, I am not sure if there is a way to prevent this behavior ?

I was thinking to force Meteor.disconnect() after my data is grounded locally and only reconnect on a chosen interval to synchronize the data, but it really goes against meteor reactivity…

Any suggestions are very welcome :wink:

Thanks


#2

I have been tracking down the problem, which actually seems to come from dispatch:kernel package imported in ground:db .
The package overwrites some of the default Meteor api https://github.com/DispatchMe/meteor-kernel/blob/master/meteor.js
After commenting it out, I do not have the disconnection problem anymore…
I havent really investigate on possible side effects of removing this feature but it seems to do the job for now.