Fetcher: An Alternative Way for Sending Data to Your Client [POC]


I feel like Meteor needs a clean way to retrieve static data from the server, so I decided to scratch my itch with this proof of concept package. It relies on Method’s and Reactive-Dict to help you pull static data from the server, display it on the client, and refresh as needed.

I had some free time today, so I put together a demo here. You can also read more on GitHub. I thought I’d throw it out early to see what people think and to see if anyone else wants to join the effort.


I read the code and tried to make sense on what this is. From my understanding it just makes a Meteor Method call in a helper and … that’s it. There is nothing wrong in fetching data this way, but I usually use this package: https://atmospherejs.com/simple/reactive-method


That looks like a great package, and in some ways its similar to Fetcher. I think the key difference here is Fetcher lets you pull the data once and use it anywhere, and there are some different end goals:

  • make it easier/cleaner to write than a method
  • plug it into Meteor.publish() (bypass need to write methods)

BTW, first time seeing it. I see it has refresh and other stuff - so maybe the solution is there. How would you go about setting up a loading template until the data arrives?


@slava, Agree with your post. I think that kind of packages makes Meteor not so clear as it is. I guess next awesom package:

// This package allows you to CREATE documents for Mongo Collection. Because CREATE is more semantically relevant instead of INSERT

Mongo.Collection.prototype.create = Mongo.Collection.prototype.insert


Also, people who use methods to retrieve documents do not have many debug capabilities (compared to minimongo). By building this off Reactive-Dict, you can add other capabilities to it and debug tools like Mongol can help you view/edit them. I suppose you can call a method in your console and work with it it from there, but its a lot of extra work.


I think I would personally prefer an API where you can use subscriptions and have the results be available in Minimongo. Basically a switch on a subscription that just polls the endpoint instead of having realtime updates. I feel like this could be possible through the simple:rest package, which exposes subscriptions over HTTP endpoints.


@slava - You use reactive-method, and haven’t been bitten by the bug I reported a couple months ago? https://github.com/stubailo/meteor-reactive-method/issues/2

Since it’s as easy my test case shows to create an infinite loop of Meteor.call, and as challenging to fix that it hasn’t been fixed in 2 months, and with a failing test already committed, then I don’t know if recommending the package widely is a very good idea.

I’d love your input on that issue. The TL;DR: Any call argument that does not compare as identical to itself on future calls borks the whole application. This means reactive-method is only useful if you don’t pass dynamically created variables, and actually harmful if you stumble off that happy path.


I used it only in a couple of simple cases ala “when you want to render this template, make this one fetch”


I clarified my position on the issue, and suggested an alternative package with the functionality you are looking for.


I had some trouble falling asleep so I decided to make the v1 :smiley:

It’s pretty similar to ReactiveMethod, but it stores the data into a Reactive Dictionary, which offers the following benefits:

  • you can use it anywhere in the app
  • persists through hot reloads
  • you can override it whenever you want
  • it could integrate with Mongol/JetSetter :wink: