Hi Forum,
I have an issue with what should be a simple pub/sub. The pub/sub works fine before a user logs in; sending 5 small documents to the client in a couple seconds.
However, immediately after a user logs in, the data is removed from the client, and the publication is slow to rerun, hangs and never returns, or eventually returns but only after several minutes.
I have no idea why the user’s login status is impacting this. But I verified it by logging the user out and the publication works quickly again. The publication doesn’t depend on any user data though, so I’m confused about what the connection is between the user’s login status and the publication.
I’m using accounts-base, accounts-password, and iron-router. Here is the relevant code:
// Server Publish
Meteor.publish("module_instance", function (app_id) {
return = ModuleInstance.find({'app_id':app_id});
});
Iron Router global configuration subscribes to the publication. The getAppId() method just parses the URL for an ID string and returns it. I’ve confirmed its always returning the correct value.
// Global router configuration
Router.configure({
'loadingTemplate' : 'loading',
'notFoundTemplate': 'loading',
'layoutTemplate' : 'fullscreen_layout',
'waitOn' : function(){
return Meteor.subscribe('module_instance', getAppId());
},
'onRun' : function(){
this.next();
}
});
Does anyone have any thoughts on what I’m doing wrong?