A lightweight transport for WebSocket based connections with Pipecat
WebSocketTransport
enables a purely WebSocket based connection between clients and your Pipecat application. It implements bidirectional audio and video streaming using a WebSocket for real-time communication.
This transport is intended for lightweight implementations, particularly for local development and testing. It expects your Pipecat server to include the corresponding WebSocketTransport
server-side implementation.
WebSocketTransport
is best suited for server-server applications and prototyping client/server apps.For client/server production applications, we strongly recommend using a WebRTC-based transport for robust network and media handling. For more on WebRTC vs. Websocket communication, check out this article.WebSocketTransport
takes the same options as the constructor; WebSocketTransportOptions
. Anything provided here will override the defaults set in the constructor. The ws_url
is required to establish a connection.
PipecatClient
and should be called from the PipecatClient
. However, there is one transport-specific methods that you may need to call directly. When doing so, be sure to access your transport via the transport
property of the PipecatClient
instance.
ArrayBuffer
of audio data.PipecatClient
event handlers.