You are currently viewing the React version of this page. Use the dropdown
to the right to customize this page for your client framework.
Connection-time configuration
Often you need to pass configuration to the server when starting the bot — a system prompt, preferred language, user preferences, or any other data the server needs before the pipeline runs. Pass it viarequestData in startBotAndConnect().
Sending messages to the server
UsesendClientMessage() to send a fire-and-forget message to the bot. The server handles it and is not expected to send a direct response.
on_client_message event handler or from inside a FrameProcessor:
Requesting data from the server
UsesendClientRequest() to send a message and wait for a response. Useful for querying server state or triggering an action that needs to confirm success or failure.
on_client_message event handler with send_server_response() or send_error_response(), or from a FrameProcessor by pushing an RTVIServerResponseFrame that carries the request’s RTVIClientMessageFrame. Set error instead of data to send an error response:
Receiving messages from the server
The server can push unsolicited messages to the client at any time — for example, to notify the client that a setting has changed.Use
On the server, send messages by pushing an useRTVIClientEvent to subscribe to ServerMessage within a component:RTVIServerMessageFrame:
await worker.queue_frame(RTVIServerMessageFrame(data={...})).
API reference
Client Methods
sendClientMessage, sendClientRequest, registerFunctionCallHandlerCallbacks & Events
onServerMessage, onMessageError, and related events