- Read our Realtime documentation to understand how the Trigger.dev realtime API works.
- Read how to setup and authenticate using the
@trigger.dev/react-hookspackage.
Hooks
useRealtimeRun
TheuseRealtimeRun 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
TheuseRealtimeRunsWithTag 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
TheuseRealtimeBatch hook allows you to subscribe to a batch of runs by its the batch ID.
useRealtimeRunWithStreams
TheuseRealtimeRunWithStreams 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:
Common options
accessToken & baseURL
You can pass theaccessToken option to the Realtime hooks to authenticate the subscription.
enabled
You can pass theenabled option to the Realtime hooks to enable or disable the subscription.
id
You can pass theid option to the Realtime hooks to change the ID of the subscription.
experimental_throttleInMs
The*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.
Examples
Image Generation with fal.ai
A Next.js app that uses the Realtime API and react hooks to create on-demand image generation
through fal.ai’s services.
Realtime CSV Importer
Upload CSV files and view the progress of the task being processed on the frontend live using
the Realtime API.
Batch LLM Evaluator
A Next.js app that uses the Realtime API and react hooks to evaluate language model responses on
the frontend in real-time.
Claude Thinking Chatbot
A chatbot that demonstrates Claude 3.7’s thinking capabilities through the Realtime API and
react hooks.

