PipecatClient
makes it easy to send this data as part of the connect()
method, by passing an object with the requestData
property. Your server endpoint can then handle this data as needed. In the example below, we demonstrate sending an initial prompt and preferred language to the server when connecting.
sendClientMessage
method. This is useful for triggering specific actions or sending data that the server needs to process.
sendClientRequest
method. This is useful for querying the server for specific data or triggering and action and getting a success/failure response.
onServerMessage
callback. This allows you to process messages that the server sends back to the client, such as notifications or updates.