Skip to main content
You are currently viewing the React version of this page. Use the dropdown to the right to customize this page for your client framework.
The Pipecat client emits events throughout the session lifecycle — when the bot connects, when the user speaks, when a transcript arrives, and more.

Subscribing to events

Callbacks

Pass handlers in the PipecatClient constructor. Good for events you always want to handle, defined once at setup:

Event listeners

In React, use the useRTVIClientEvent hook to subscribe within a component. It handles registration and cleanup automatically when the component mounts and unmounts:
You can also use .on() directly on the client instance, but useRTVIClientEvent is preferred in React since it avoids stale closure issues and cleans up automatically.

Event reference

Session and connectivity

These events track the connection state of the client and bot. See Session Lifecycle for the full state progression.
BotReady receives a BotReadyData object with a version field — the RTVI version the bot is running. You can use this to check compatibility if your client and server may be on different versions.

Voice activity

These events are driven by the bot’s VAD (voice activity detection) model. VAD is smarter than tracking raw audio levels — it understands turn-taking, so it can distinguish between a user who has finished speaking and one who has simply paused or is speaking slowly.
UserMuteStarted/UserMuteStopped reflect server-side muting — the client continues sending audio, but the bot is ignoring it. Use these to update your UI (e.g., show a muted indicator) without actually stopping the local mic.

Transcription and bot output

UserTranscript fires continuously as speech is recognized. Check data.final to distinguish committed transcripts from work-in-progress partials:
BotOutput is the recommended way to display the bot’s response text. It provides the best possible representation of what the bot is saying — supporting interruptions and unspoken responses. By default, Pipecat aggregates output by sentences and words (assuming your TTS supports streaming), but custom aggregation strategies are supported too - like breaking out code snippets or other structured content:

Errors

Always handle Error. If data.fatal is true, the bot has already disconnected — update your UI accordingly:

Devices and tracks

Function calling

These events fire when the bot’s LLM makes a function call. Use them to track status and display relevant UI (e.g., a loading spinner while the call is in progress).

Other

For custom server<->client messaging, see Custom Messaging.

API reference

React Hooks

useRTVIClientEvent and other React-specific event utilities

JavaScript SDK Callbacks

Complete callback signatures, data types, and transport compatibility