The example repos are currently a bit outdated. This guide is the authoritative reference.
Understanding WebSockets
Unlike the request-response model of HTTPS, WebSockets maintain an open connection between client and server — enabling two-way message exchange without reconnecting for faster data streaming.Communication Protocol
The protocol requires:- Your server to send the first message — send an empty response to let the user speak first
- UponAI sends live transcripts to your server and expects responses when needed
- You stream what you want the agent to say and UponAI speaks it out
Step 1: Add a Basic WebSocket Endpoint
Step 2: Create a Dummy Response System
Before connecting a real LLM, build a dummy response system that greets with “How may I help you?” and replies to all questions with “I am sorry, can you say that again?”llmClient.DraftResponse() after receiving each message:
Step 3: Test Your Basic Agent
1
Get your WebSocket URL
- Production:
wss://your_domain_name/llm-websocket/ - Local testing: Use ngrok to generate a forwarding URL:
wss://xxxxx.ngrok-free.app/llm-websocket/
2
Add URL to dashboard
Enter your WebSocket URL in the UponAI dashboard agent settings.
3
Test
Click Make a web call. The agent should greet with “How may I help you?” and reply to all questions with “I am sorry, can you say that again?”