danielqiu/feed

recommended way to call feedReader() for reactivity

Closed this issue · 4 comments

Is the best way to invoke the Feed.read() function from your example going to be in Meteor.startup()?

I'm doing it this way and things aren't updating reactively. I'm also (strangely) not getting all of my Atom entries, though that could be an unrelated issue.

if (Meteor.isServer) {
  Meteor.startup(function () {
    function feedReader() {
      // pass the created collections to Feed.collections()
      var collections = {
          feeds: Feeds,
          feed_entries: FeedEntries
      }

      Feed.collections(collections);

      var the_feed = {
          link: "link/to/feed"
      };

      Feed.createAtomFeed(the_feed);


      // invoke Feed.read() to get real-time reactive social stream
      Feed.read();
    }

   feedReader();

  });
}

@zaklampert
You are correct, it should be in Meteor.startup().

Please take a look at my example: feed-demo, you could clone it to see if it gets entries and changes to your link, credential etc..

Please let me know how it goes.

cool, it seems to be correctly fetching things now. I just moved the function feedReader() outside of the Meteor.startup then called feedReader() inside Meteor.startup()

So, i'm getting all the items from my feed, but if I change an item, it is not updating reactively (editing a title). Should it? I'm basically trying to use a third party cms that has Atom exporting as my meteor app's cms. Do you think it's possible?

@zaklampert
I am glad that it works.

For the update, it depends on the implementation of the Atom of the third party cms system. It might not emit update events. Is there any way you could manually see if it has an update event?

[update]For example, I tried to update this post, and checked my original feed, Github doesn't emit an update event.

Do you see the feed right away if you have a new post in the cms?

I have multiple feeds in my project. And chances are some items arrive in 2 or more feeds. FeedParser would then throw a Mongo DB insertion error. Any idea how to handle this?