How to force a client to resubscribe?


#1

So right now when the server comes back up from a crash, clients reconnect and they “re-subscribe” to the publications. Is there a way to force this action?

Here’s the overly simplified version of what I’m after:

Meteor.publish("people", function () {
  self = this;
  _.each( GetDataFromWhoKnowsWhere() , function(person) {
	self.added("people", person._id, person);
  });
  self.ready();
})

Meteor.methods({
  resetPeople: function () {
	// Do something so the client re-subscribes.
	// The client's cache should then have the data 
	// from GetDataFromWhoKnowsWhere().
	// As if the server just came back up from a crash.
  }
})

#2

Use pure javascript to polling and resubscribe in the same way as GMail which reconnect to your email.


#3

Does http://docs.meteor.com/#/full/meteor_disconnect work for you?


#4

Thanks for the ideas. In my case I’ll have to create a publication to tell the clients when they have to reconnect. On the clients I’ll have to subscribe to that publication and put Meter.disconnect() and Meteor.reconnect() in an autorun. Not hard, but not a one liner either.