PipecatClient
s communicate with their bot services. Transports implement the underlying device management, connectivity, media transmission, and state logic that manage the lifecycle of your session.
All transport packages (such as DailyTransport
) extend from the Transport
base class defined in the client-js
library. You can extend this class if you are looking to implement your own or add additional functionality.
connect()
, allowing you to connect to different bot services without needing to create a new transport or client each time.
TransportState
Your transport instance goes through a series of states during its lifecycle. These states are:
Disconnected
Initializing
pcClient.initDevices()
call, where the transport is being set up in order to enumerate local media devices. If you call connect()
and bypass initDevices()
, the transport will skip this state and go directly to Authenticating
or Connecting
.Initialized
pcClient.initDevices()
call and skipped if initDevices()
is not used.Authenticating
pcClient.connect()
with a ConnectionEndpoint
and is waiting for a response from your server containing connection details for your transport (such as a session URL and token). Note: If you provide the TransportConnectionParams
directly, the transport will skip this state and go directly to Connecting
.Authenticated
pcClient.connect()
with a ConnectionEndpoint
and has successfully received a response. It will quickly move into the Connecting
state.Connecting
Connected
Ready
Disconnecting
Error
Disconnected
state.pcClient.state
, or by defining a callback or event: