Displaying data from external API without MongoDB collection


I would like to reactively display data fetched from an external API on an interval without the overhead of persisting it to the database. I know how to achieve this on the client side using ReactiveVar, but what about calls on the server?

Example of what I’m trying to complish (does not do what I expect):

import { ReactiveVar } from 'meteor/reactive-var';
export const Time = new ReactiveVar(new Date().getTime());

if (Meteor.isServer) {
  Meteor.publish('time', function timePublication() {
    return Time.get();

  Meteor.setInterval(() => { 
    Time.set(new Date().getTime());
  }, 3000);

In this particular example, I could of course move the interval call to client code and it would work, but I want this to occur on the server so I can make external HTTP calls. The client receives the initial value from new Date().getTime(), but not the updates from the interval in the server code. What am I missing here?


Check this post: