Get live updates from the Trigger.dev API in your frontend application.
@trigger.dev/react-hooks
package.useRealtimeRun
hook allows you to subscribe to a run by its ID.
useRealtimeRun
hook:
onComplete
callback to the useRealtimeRun
hook to be called when the run is completed or errored. This is useful if you want to perform some action when the run is completed, like navigating to a different page or showing a notification.
useRealtimeRunsWithTag
hook allows you to subscribe to multiple runs with a specific tag.
useRealtimeRunsWithTag
hook:
useRealtimeRunsWithTag
could return multiple different types of tasks, you can pass a union of all the task types to the hook:
useRealtimeBatch
hook allows you to subscribe to a batch of runs by its the batch ID.
useRealtimeRunWithStreams
hook allows you to subscribe to a run by its ID and also receive any streams that are emitted by the task. See our Realtime documentation for more information about emitting streams from a task.
useRealtimeRunWithStreams
hook:
accessToken
option to the Realtime hooks to authenticate the subscription.
enabled
option to the Realtime hooks to enable or disable the subscription.
id
option to the Realtime hooks to change the ID of the subscription.
*withStreams
variants of the Realtime hooks accept an experimental_throttleInMs
option to throttle the updates from the server. This can be useful if you are getting too many updates and want to reduce the number of updates.