Always alive service/job for periodic status check


Hello everyone,

I’m looking for a solution on AdonisJS where I can have a “service” which is starting as adonis starts. More specifically, I would like to be able to start polling a third party server as AdonisJS starts and updating a status on a DB, so that I can communicate such status to a front end via Web Socket.

I’ve started looking into the documentation, and bumped into Service Providers, but I am not sure this is what I am looking for.

Can somebody help me to find the right way to address this problem please?

In the meantime I’ve found this: Adonis Scheduler. I am still not sure if it is the right solution for what I want to do, but I think I will give it a try.



I solved using the Adonis Scheduler in the end.
Basically I scheduled a Task that every 5 seconds polls the status from the third party server and updates the status in Mongo. This way I have an always up-to-date state on Mongo that I can push to a front end via WebSocket on every status change (at least this is my intention).