Client to server events
Send contextual information from the client to enhance conversational applications in real-time.
Client-to-server events are messages that your application proactively sends to the server to provide additional context during conversations. These events enable you to enhance the conversation with relevant information without interrupting the conversational flow.
For information on events the server sends to the client, see the Client events documentation.
Overview
Your application can send contextual information to the server to improve conversation quality and relevance at any point during the conversation. This does not have to be in response to a client event received from the server. This is particularly useful for sharing UI state, user actions, or other environmental data that may not be directly communicated through voice.
While our SDKs provide helper methods for sending these events, understanding the underlying protocol is valuable for custom implementations and advanced use cases.
Contextual updates
The primary client-to-server event is the contextual update, which allows your application to send non-interrupting background information to the conversation.
Key characteristics:
- Updates are incorporated as background information in the conversation.
- Does not interrupt the current conversation flow.
- Useful for sending UI state, user actions, or environmental data.
Best practices
-
Contextual updates
- Send relevant but concise contextual information.
- Avoid overwhelming the LLM with too many updates.
- Focus on information that impacts the conversation flow or is important context from activity in a UI not accessible to the voice agent.
-
Timing considerations
- Send updates at appropriate moments.
- Consider grouping multiple contextual updates into a single update (instead of sending every small change separately).
For detailed implementation examples, check our SDK documentation.