I am welcoming the new change in 1.0.4 that brings a subscribe method to Templates which works exactly as Meteor.subscribe and automatically stops the subscription when the template is destroyed. This should make for much cleaner code.
However, how am I supposed to use this new feature when I am connecting to a remote server via DDP.connect?
Good point! That is an oversight in the current API - we should add an option to use a different connection.
For now, as a workaround, you can use regular Meteor.subscribe inside this.autorun, which has a very similar effect. You won’t get the subscriptionsReady method, but it’s a start.
Could you file a feature request on GitHub for this?
I just went through the source and saw that in blaze/template.js it defines subscribe as this.view.subscribe, and in blaze/view.js Blaze.View.prototype.subscribe it actually checks in options for connection
Basically we added it as an internal API to views, but made the API more extensible by taking the arguments as an array. I actually forgot we did this, but it was @glasser’s idea to address exactly this case.
Too bad. If I remember correctly, that was the only place I found that in the code and pointed out that it doesn’t work and changed it in my pull request …
Yeah, 1.2 has been taking a while, but we are doing our best. 1.1.0.3, as the small version change suggests, was only a fix for facebook login after they changed the API.