I want to show the progress of a long-running server method on the client side. Is there a way to send some data back to the client while a server method is still running?
Just an idea.
You could subscribe to a collection, say ProgressReport, and just update it in your method call whenever needed.
What do you think?
Thanks for answering. Yes, this should work, but to be honest, I think this is a rather “hacky” way to do it. Polluting the database with performance indication data just feels a bit strange to me. I was rather thinking about a way to use the DDP connection that the Meteor method is being called with with for sending intermediate results, but I don’t know if this is even possible?!
What about using the Event emitter package, and listening to a custom progress event related to the userId?
That sounds interesting, did not know it. Will this also work across the client-server boundary? The examples seem to illustrate how to use it on one side of the fence only.
Aaah, that looks much more like it Thanks!
Or you can probably cook something with https://meteorhacks.com/introducing-meteor-streams
With looong running tasks I would think of persisting it in DB so you can logout/relog etc and still be able to track it tho. When method would just start something and report back to client with just info if task was inicialized.
I don’t think that package is maintained anymore, though But it was a good project.
Well, maybe package is not extra up2date, but principles how to manage something like that over DDP without involving database stay quite stable over time.