Protocol Overview
The RTC Agent protocol consists of three layers, each with its own role: HTTP API handles authentication, WebSocket RPC handles all business operations, and real-time events drive frontend-backend state synchronization.
Protocol Layers
Section titled “Protocol Layers”| Layer | Protocol | Purpose | Features |
|---|---|---|---|
| 🔐 Auth Layer | HTTPS | OAuth2 authorization code flow | Standard HTTP, compatible with all OAuth2 Providers |
| 💬 Operation Layer | WebSocket RPC | Session, Message, Turn, RTC operations | 16 methods, divided into Action and Query types |
| 📢 Event Layer | WebSocket Pub/Sub | Real-time state push | Dual-channel (Topic + Live), supports offline recovery |
Auth Layer: HTTP API
Section titled “Auth Layer: HTTP API”Handles user login and token management, following the standard OAuth2 authorization code flow.
3 endpoints cover the complete authentication lifecycle:
| Endpoint | Method | Function |
|---|---|---|
/oauth2/authorize | GET | Get OAuth2 authorization redirect URL |
/oauth2/token | POST | Exchange authorization code for access_token |
/oauth2/refresh | POST | Refresh access_token |
Operation Layer: WebSocket RPC
Section titled “Operation Layer: WebSocket RPC”All business operations are performed over WebSocket RPC — sending messages, querying sessions, submitting tool results — all on a single persistent connection.
4 business domains, 16 methods:
| Domain | Action | Query |
|---|---|---|
| Session | close · update · fork · compact | list · get |
| Message | send | list · get |
| Turn | stop | list · get |
| RTC | update_status · submit_result | list · get |
👉 Detailed docs: WebSocket RPC
Event Layer: Real-Time Events
Section titled “Event Layer: Real-Time Events”The server pushes real-time events through a dual-channel architecture, balancing reliability and low latency.
| Channel | Purpose | Features |
|---|---|---|
| Topic | State change events | Persisted, Offset tracking, Offline recovery |
| Live | Streaming message intermediate chunks | Non-persisted, low latency, fire-and-forget |
👉 Detailed docs: Real-Time Events
Data Flow Panorama
Section titled “Data Flow Panorama”Next Steps
Section titled “Next Steps”- HTTP API — Detailed definition of OAuth2 authentication endpoints
- WebSocket RPC — Complete reference for all 16 RPC methods
- Real-Time Events — Dual-channel event push mechanism
- Architecture Overview — Learn about the overall architecture design of RTC Agent