Reputation: 596
From the docs:
Sophisticated clients can turn subscriptions on and off to control how much data is kept in the cache and manage network traffic. When a subscription is turned off, all its documents are removed from the cache unless the same document is also provided by another active subscription.
How is a subscription turned off? Example code below.
Client and server:
Rooms = new Meteor.Collection("rooms");
Server:
Meteor.publish("rooms", function () {
return Rooms.find();
});
Client:
Meteor.subscribe("rooms");
...
//Now turn off the subscription
Upvotes: 0
Views: 231
Reputation: 3158
Meteor.subscribe() returns a handle which you can call the stop method on.
//subscribe
roomSubscription = Meteor.subscribe("rooms");
//stop subscription
roomSubscription.stop();
more info on this here: http://docs.meteor.com/#meteor_subscribe
Upvotes: 2