Overview
SmallWebRTCTransport enables peer-to-peer (“serverless”) WebRTC connections between clients and your Pipecat application. It implements bidirectional audio, video and data channels using WebRTC for real-time communication. This transport is open source and self-contained, with no dependencies on any other infrastructure.
SmallWebRTC Transport API Reference
Transport methods and configuration options
SmallWebRTC Connection API Reference
Connection management and signaling methods
Example Implementation
Complete peer-to-peer voice agent example
WebRTC Documentation
Official WebRTC protocol documentation
Installation
To use SmallWebRTCTransport, install the required dependencies:Prerequisites
WebRTC Application Setup
Before using SmallWebRTCTransport, you need:- Signaling Server: Implement WebRTC offer/answer exchange (required)
- Client Implementation: Set up WebRTC client for browser or application use
- ICE Configuration: Configure STUN/TURN servers for NAT traversal (optional for local networks)
- Development Runner: Use Pipecat’s development runner for quick setup (recommended)
Configuration Options
- Development Runner: Automatic server infrastructure and web interface (recommended)
- Manual Implementation: Custom signaling server for advanced use cases
- ICE Servers: STUN/TURN configuration for network traversal
- Media Configuration: Audio/video parameters and format handling
Key Features
- Serverless Architecture: Direct peer-to-peer connections with no intermediate servers
- Production Ready: Heavily tested and used in Pipecat examples
- Bidirectional Media: Full-duplex audio and video streaming
- Data Channels: Application messaging and signaling support
- Development Tools: Built-in development runner with web interface
Configuration
SmallWebRTCTransport
The underlying WebRTC connection handler that manages signaling and peer connections.
Transport configuration parameters for audio, video, and VAD settings.
Optional name for the input transport processor.
Optional name for the output transport processor.
Usage
SmallWebRTCTransport requires both a signaling server for WebRTC handshake and your Pipecat bot implementation. The easiest approach is using Pipecat’s development runner which handles all server infrastructure automatically. See the complete examples for full implementations including:- Development runner setup with automatic web interface
- Manual signaling server implementation
- WebRTC client integration
- ICE server configuration for production deployment
Event Handlers
SmallWebRTCTransport provides event handlers for client connection lifecycle and application messaging. Register handlers using the@event_handler decorator on the transport instance.
Events Summary
| Event | Description |
|---|---|
on_client_connected | Client WebRTC connection established |
on_client_disconnected | Client WebRTC connection closed |
on_app_message | App message received from client |
Connection Lifecycle
on_client_connected
Fired when a client establishes a WebRTC peer connection.| Parameter | Type | Description |
|---|---|---|
transport | SmallWebRTCTransport | The transport instance |
webrtc_connection | SmallWebRTCConnection | The WebRTC connection object |
on_client_disconnected
Fired when a client’s WebRTC peer connection is closed.| Parameter | Type | Description |
|---|---|---|
transport | SmallWebRTCTransport | The transport instance |
webrtc_connection | SmallWebRTCConnection | The WebRTC connection object |
Messaging
on_app_message
Fired when an application message is received from a client through the WebRTC data channel.| Parameter | Type | Description |
|---|---|---|
transport | SmallWebRTCTransport | The transport instance |
message | Any | The message content |
sender | str | The sender’s peer connection ID |
Additional Resources
- Events Overview - Overview of all events in Pipecat
- Pipecat Development Runner’s Transport Utilities
- Client SDK Integration