Execution of server-side code?

Hello,
I have developed a portal that works client side. Now I want the code to automatically execute server side with a timer . But I do not understand how the code is executed . For example if I created a function will be executed even if I have not called … ???

Thank you

In principle, once the server code is running, it runs continuously, eben with no clients connected. This means that there are a number of options open to you for running code via a timer.

For interval running (run something every “x”) you should look at percolate:synced-cron. That is the “go to” route for this kind of thing, as it takes care of a lot of stuff for you, including multiple server instances (scale-out architecture).

If you just need a single-shot timer, or don’t have multiple server instances and you don’t want the overhead of synced-cron, you can use Meteor.setTimeout or Meteor.setInterval: see the docs.

1 Like

Thank you very much!

1 Like