io.backgroundPoll()
io.backgroundPoll()
allows you to fetch data from a URL on an interval.
These are the docs for Trigger.dev v2 which will be deprecated on January 31st, 2025. You probably want the v3 docs.
Parameters
Should be a stable and unique cache key inside the run()
. See
resumability for more information.
The url to fetch.
The interval in seconds to wait between requests. Minimum interval is 10 seconds and maximum is 5 minutes.
The timeout in seconds before aborting the polling. Minimum timeout is 30 seconds and maximum is 1 hour.
Options for the fetch request
Allows you to filter the response to determine when to stop polling.
An optional object to specify a timeout for each individual request.
Returns
A Promise
that resolves with the JSON response body of the matching background fetch request. You can specify the type of the response body as a generic parameter.