start()
method that handles the handshake and authentication with your bot service. Typically, calling this method will make a web request to an endpoint you create, initiating a new bot process and returning authentication credentials to join a session.VoiceClient
is a base class that serves as a template for building transport-specific implementations. It has no out-of-the-box bindings included.
realtime-ai
library exports a VoiceClient
that has no associated
transport logic. When building an RTVI application, you should use the export
for your chosen transport layer or provider (see here
for available first-party packages.)DailyVoiceClient
) extend from VoiceClient
. You can extend this class if you are looking to implement your own transport or add additional functionality.
VoiceClient
will send a JSON POST
request to this URL and pass the local configuration (config
) as a body param. You can override this behaviour by defining a customAuthHandler property.Depending on your Transport
, this endpoint should return a valid authentication bundle (e.g. URL, access token etc) required to join a session.Property | Description |
---|---|
key | exact match for service type in your bot file, e.g. llm . |
value | the service which you wish to use, matching a registered service in your bot file, e.g. openai . |
VoiceClientConfig
array.Client config is passed to the bot at startup, and can be overriden in your server-side endpoint (where sensitive information can be provided, such as API keys.)The service order of your configuration array is important. See configuration.Transport
class. If your transport package (e.g.
realtime-ai-daily
) exports multiple transports classes, you can specify
which to use here.start()
. If the timeout period is elapsed, the client will return a
ConnectionTimeoutError
error and disconnect from the transport.start
web request to the
baseUrl
.start
method.voiceClient.start()
.baseUrl:string
Endpoint provided in client constructor.timeout:Timeout | undefined
Start timeout. You should clear this once your method resolves e.g. clearTimeout(timeout
.abortController:AbortController
- Abort via abortController.abort()
in the event of an error response will clear the connection timeout and set the client to an error state.