Overview
LiveKit provides several APIs for exchanging data between participants. Each is designed for a different interaction pattern — guaranteed delivery of text or files, request-response workflows, continuous low-latency streaming, or synchronized shared state.
Choosing the right API
| Task | Recommended API | Pattern | Description |
|---|---|---|---|
| Send text (chat, LLM responses) | Text streams | Guaranteed, message-based | Automatic chunking and topic-based routing. |
| Send files or binary data | Byte streams | Guaranteed, message-based | Transfer files, images, or any binary data with progress tracking. |
| Call a method on another participant | RPC | Guaranteed, message-based | Execute custom methods on other participants and await a response. |
| Stream continuous data (sensors, telemetry, game state) | Data tracks | Lossy, continuous | Prioritizes staying realtime over guaranteed delivery. Frames that can't be delivered in time are dropped. |
| Synchronize shared state | State synchronization | Guaranteed, message-based | Replicate participant attributes and room metadata across all participants. |
| Low-level control over individual packet delivery | Data packets | Guaranteed or lossy, message-based | Advanced API for precise control over individual packet behavior. For lossy delivery, data tracks offer similar control when frame payloads fit in a single packet. |
In this section
Sending text
Use text streams to send and receive text data, such as LLM responses or chat messages.
Sending files & bytes
Use byte streams to transfer files, images, or any other binary data.
Remote method calls
Use RPC to execute custom methods on other participants in the room and await a response.
Data tracks
Stream continuous, low-latency data for robotics, IoT, and telemetry use cases.
Data packets
Low-level API for advanced control over individual packet delivery.
State synchronization
Synchronize participant attributes and room metadata across all participants.