What It Demonstrates
This example shows:- ✅ WebSocket message formats
- ✅ Client message types
- ✅ Server message types
- ✅ Audio streaming format
- ✅ Event-to-message mapping
- ✅ Protocol debugging
Prerequisites
- Flutter SDK 3.0.0 or higher
- Kuralit Flutter SDK installed
- A running AI Voice Agent server
Step-by-Step Explanation
Step 1: Initialize SDK
Step 2: Listen to All Events
The example listens to all event types and displays the underlying protocol messages:Full Code Structure
The example includes:- Event Logging - Logs all SDK events
- Protocol Display - Shows JSON message formats
- Audio Streaming - Demonstrates audio protocol
- Message History - View all sent/received messages
- Format Display - See actual WebSocket message formats
How to Run
Step 1: Update Configuration
Editmain.dart:
Step 2: Run
Expected Behavior
- App starts - SDK initializes
- Connection - See connection messages
- Send message - See client message format
- Receive response - See server message format
- Audio streaming - See audio message formats
Message Formats Shown
Client Messages
client_text- Text message formatclient_audio_start- Audio stream startclient_audio_chunk- Audio data chunksclient_audio_end- Audio stream end
Server Messages
server_connected- Connection confirmationserver_text- Final text responseserver_partial- Streaming text responseserver_stt- Speech-to-text transcriptionserver_tool_call- Tool execution notificationserver_tool_result- Tool execution resultserver_error- Error messages
Use Cases
This example is useful for:- Understanding the protocol - See actual message formats
- Debugging - Identify protocol issues
- Custom implementations - Build custom clients
- Learning - Understand how the SDK works
Next Steps
- Protocol Reference → - Complete protocol documentation
- Basic Chat → - Simple implementation
- Basic Usage → - Usage guide
Related
- Protocol → - Complete WebSocket protocol reference
- Basic Usage → - SDK usage guide

