Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Meteor retain reactivity when using a REST API

I am planning to use Qualtrics REST API, in order to get the data collected from a survey. Can i still retain Meteor's reactivity directly thru the rest api or should I save the data from the rest API into MongoDB to enable for real time updates within the app?

Any advice and further reading will be great.

This will sound like a noob question probably but I am just starting off with Meteor and JS as server side code and never used a web api before.

like image 957
ivan Avatar asked Jan 02 '14 17:01

ivan


1 Answers

It entirely depends on what you do with the data it returns. Assuming you're either polling periodically or the API has some kind of push service (I've never heard of it before, so I have no idea), you would need to store the data it returns in a reactive data source: probably a Collection or Session variable, depending on how much persistence is required. Any Meteor templates that access these structures have reactivity built in, as documented here.

Obviously, you will probably need to be polling the API at an appropriately regular interval for this set up to work though. Take a look at Meteor.setInterval, or the meteor-cron package, which is probably preferable.

like image 87
richsilv Avatar answered Sep 20 '22 18:09

richsilv