Is it true that Tracker is client-side only?

I just suggested using Tracker as a solution to a fellow forum member’s problem (Async function server method using YQL npm module)

He replied that my suggestion is not valid since Tracker does not work on the server, which surprised the hell outta me.

Is he right?

1 Like

It’s true, Tracker is meant for client-side only. There are alternative approaches though, probably you’ll want to react to data changes, for which you can use cursor.observeChanges().

Other options are collection hooks: https://atmospherejs.com/matb33/collection-hooks

And server-autorun if you really need the autorun capability: https://atmospherejs.com/peerlibrary/server-autorun

1 Like

Really good to know. Thank you.

Now that I return to the documentation I see “Client” specified in the title bar of every method – (too big to see ¡duh! )

@mitar created a server-side version of Tracker though (for autoruns). You can give that a try: https://atmospherejs.com/peerlibrary/server-autorun

And technically, Tracker is usable in the server, it’s just that your autoruns need to be inside Meteor.bindEnvironment() (if you do things requiring to be Fiber-wrapped, like MongoDB operations).

Tracker.autorun(Meteor.bindEnvironment(function () {
   myDependency.depend();
   // Do reactive stuff...
}));

Here’s an example: http://meteorpad.com/pad/46mGdsa6LRHKcKFut/Server-side%20Tracker