I’ve followed this doc article https://guide.meteor.com/data-loading.html#loading-from-rest
to set up a simple custom publication (I modified the example code for a simple test without a need to setup a 3rd REST endpoint):
const POLL_INTERVAL = 5000;
var count = 0;
Meteor.publish('polled-publication', function() {
this.added("simple_counter", 'id', {value: count});
const poll = () => {
count++;
this.changed("simple_counter", 'id', {value: count});
};
poll();
this.ready();
const interval = Meteor.setInterval(poll, POLL_INTERVAL);
this.onStop(() => {
Meteor.clearInterval(interval);
});
});
For the client subscriber side I tried simple:rest which was also mentioned in the same article. I could see the publication data in JSON when requesting http://host:port/publications/polled-publication. I assume in this method, the publication must be polled by sending http requests and the responses must be parsed for example before inputting into templates.
Are there any meteor APIs/packages that support accessing custom publication data (DB less) in form of js objects and with reactivity? I saw the published collection data pushed to client when monitoring the websocket transmission after Meteor.subscribe() is called. There would be no need for client to poll on it. What are the options to pull these data in client code?