Search code examples
meteoriron-router

How many times does Iron Router call subscriptions?


I have a multi-page application with several routes. The subscription for each route is implemented using "waitOn", and it works fine.

I noticed that when I navigate to different pages, the subscription of the previous route is dropped. So far, no problem.

I implemented a "waitOn" call on the Router.configure level, so that a particular subscription is available from all pages.

My question is: Does Iron Router make a new call for that subscription each time I switch pages? I worry this would waste server resources.

Thank you.


Solution

  • Yes, when you switch a page the previous subscription is dropped, later when you browse back to that page Meteor resubscribes.

    There is a community package in atmosphere that caches subscriptions: https://github.com/meteorhacks/subs-manager