Crontab tasks weweb

Heyy, how can we fetch data in weweb every five minutes? or simply how can we set a crontab task?

Thank you so much!

Hey @ally :wave:

What would be your use-case?

From the docs:

It is not possible to schedule recurring API requests in WeWeb. Background Tasks are typically tasks you would run in your backend, not in your frontend.

Source: How do I schedule a recurring API request?

Front-end actions would typically be tied to user actions. You can always have workflows triggered on page load in which you add a 5 minutes loop, if the task in question should be taken when a users chills for 5 minutes on the same page I guess :slight_smile:

Aurelie gives a general example here, you can use it for creating a polling system.
You need to use wwLib.executeWorkflow instead of simply executeWorkflow.
Of course it’s very easy to transform this feature in a footgun.

1 Like

Hello Quentin, I have a counting sensor that I can call its API to have the count of a certain area. I would like to display the count and call the API every minute to refresh the count, in case the count is changed. So, I want to the API to be called without any user interventions. Thank you so much for your help!

The best use-case for this would be to use websockets, as running a never-ending loop every minute in your frontend could kill the app if a bug happens.

We plan on adding support for websockets with Supabase and then other providers in a few weeks. I’ll keep you posted.

We also have a set interval trigger for workflows that should be prioritized soon. In the meantime, I suggest using @dorilama’s suggestion :wink:

5 Likes

have websockets been enabled on any provider?

1 Like

Are websockets ready for Xano?

1 Like

@Quentin ?

Nope. Aren’t released yet in Xano.