Reputation: 323
I have async function on server side, that invoke from client and get data from some external sources by HTTP.call method. This is temporary data and I don't want put it in Mongo. Is a way to send this data to client except put in Mongo and do Meteor.publish?
This is piece of code:
Meteor.methods({
doRequest: function (partNumber) {
check(partNumber, String);
for (var i = 0; i < sources.length; i++) {
sources[i].params.nr = partNumber;
HTTP.call("POST", sources[i].url, { auth: sources[i].auth, params: sources[i].params }, requestHandler);
}
function requestHandler(err, res) {
if (err) {
throw new Meteor.Error("not-response", "Remote server not responding");
}
// need send array of objects to client
}
}
});
Upvotes: 1
Views: 1687
Reputation: 594
I see two ways to get this done:
Use a client only collection. You can actually publish any data not only collection cursors. Check this out: http://meteorcapture.com/publishing-anything/
[DEPRECATED] Use Meteor streams: http://arunoda.github.io/meteor-streams/
Upvotes: 3