RTVIClient
is a base class that serves as a template for building transport-specific implementations.
DailyTransport
) extend from the Transport
base class defined in RTVI core.
You can extend this class if you are looking to implement your own or add additional functionality.
Transport
required to connect to your bot service (rtviClient.connect()
). Transports define connectivity and state logic that manage the lifecycle of your session.
Transports also define a protocol for message exchange between your client and bot service (such as actions, or generic messages.If your transport package (e.g.
@daily-co/realtime-ai-daily
) exports multiple transports classes, you can
specify which to use here.Property | Description |
---|---|
connect:string | Developer hosted endpoint that triggers authentication, transport session creation and bot instantiation. Typically returns a valid authentication bundle required to join a session. Defaults to “connect/”. |
action:string | Developer hosted endpoint that triggers disconnected action for single-turn operations. Typically implemented as a HTTP Stream or Websocket. Defaults to “action/”. |
baseUrl
with any web request. This can be used to pass additional data to your server-side endpoint.Headers
object that is used when making requests to the baseUrl
.RTVIClientConfigOption[]
array.Client configuration is optional and can be passed directly to the bot via 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.connect()
. If the timeout period is elapsed, the client will return
a ConnectionTimeoutError
error and disconnect from the transport.rtviClient.connect()
will trigger a default fetch query to your baseUrl/connect
endpoint. If you need to override this behaviour, you can provide a custom connect handler.
rtviClient.connect()
. If your server-side infrastructure has specific requirements, you can provide custom behaviour here.params:RTVIClientParams
Params provided in client constructor.timeout:Timeout | undefined
Start timeout. You should clear this once your method resolves e.g. clearTimeout(timeout)
.abortController:AbortController
- Aborting connection via abortController.abort()
will reject the inflight request, clear the connection timeout and set the client to an error state.