Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

meteor:dispatch makes ddp unstable (continuously disconnect/reconnect) #5

Open
deeeed opened this issue Jun 1, 2016 · 4 comments
Open

Comments

@deeeed
Copy link

deeeed commented Jun 1, 2016

I have been trying to track down a problem with ground:db and ended up on this package that seems to cause a very unstable ddp connection on cordova.
It is very easy to reproduce, just create a blank project and add dispatch:kernel.

import { Meteor } from 'meteor/meteor';

if(Meteor.isClient) {

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

}

This is the single file on my project and when I run it on a device I can see in the console the status of the connection going offline online every few seconds.

2app.js?hash=5234220…:106 connected: false
ddp-client.js?hash=b5f1b97…:942 XHR finished loading: GET "http://192.168.0.108:3000/sockjs/info?cb=s_176_rpyo".AbstractXHRObject._start @ ddp-client.js?hash=b5f1b97…:942(anonymous function) @ ddp-client.js?hash=b5f1b97…:976
app.js?hash=5234220…:106 connected: true
2app.js?hash=5234220…:106 connected: false
ddp-client.js?hash=b5f1b97…:942 XHR finished loading: GET "http://192.168.0.108:3000/sockjs/info?cb=6krpqsv23p".AbstractXHRObject._start @ ddp-client.js?hash=b5f1b97…:942(anonymous function) @ ddp-client.js?hash=b5f1b97…:976
app.js?hash=5234220…:106 connected: true
2app.js?hash=5234220…:106 connected: false
ddp-client.js?hash=b5f1b97…:942 XHR finished loading: GET "http://192.168.0.108:3000/sockjs/info?cb=jnrqu1pdc2".AbstractXHRObject._start @ ddp-client.js?hash=b5f1b97…:942(anonymous function) @ ddp-client.js?hash=b5f1b97…:976
app.js?hash=5234220…:106 connected: true
2app.js?hash=5234220…:106 connected: false
ddp-client.js?hash=b5f1b97…:942 XHR finished loading: GET "http://192.168.0.108:3000/sockjs/info?cb=t_j_n5gxnf".AbstractXHRObject._start @ ddp-client.js?hash=b5f1b97…:942(anonymous function) @ ddp-client.js?hash=b5f1b97…:976
app.js?hash=5234220…:106 connected: true
2app.js?hash=5234220…:106 connected: false
ddp-client.js?hash=b5f1b97…:942 XHR finished loading: GET "http://192.168.0.108:3000/sockjs/info?cb=1jtjrw91zh".AbstractXHRObject._start @ ddp-client.js?hash=b5f1b97…:942(anonymous function) @ ddp-client.js?hash=b5f1b97…:976
app.js?hash=5234220…:106 connected: true

The problem is that after each reconnection the client re-subscribe to the publication and download the data again and again.

@deeeed
Copy link
Author

deeeed commented Jun 1, 2016

@raix I have been commenting out the part that extend Meteor in the lib and it fixed my problem.
Is there a measure/benchmark showing how much improvement this can bring to meteor ?

Thanks

@deeeed deeeed changed the title meteor:dispatch makes cordova ddp always disconnect/reconnect meteor:dispatch makes ddp unstable (continuously disconnect/reconnect) Jun 1, 2016
@malios
Copy link

malios commented Jun 1, 2016

I have the same problem on chrome 49.

@dagatsoin
Copy link

@raix @pdiniz13 @evallgar I confirm the fix of @deeeed works perfectly.

@raix
Copy link
Contributor

raix commented Aug 28, 2016

@deeeed can you do a pr please? (maybe put the extend meteor part in a "Kernel.extendMeteor()")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants