Skip to content

Open source alternatives to paid SaaS apps: Notion, Slack, Auth0, Vercel and more. Curated list with licenses and GitHub stars.

Fix WebSocket disconnect handling in Voice Agent server

Jaya Prasad Kavuru9b3627397c73
diff --git a/ai_agents/AI-Voice-Agent/client/package.json b/ai_agents/AI-Voice-Agent/client/package.json
index 95be303..0e7ec88 100644
--- a/ai_agents/AI-Voice-Agent/client/package.json
+++ b/ai_agents/AI-Voice-Agent/client/package.json
@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
- "dev": "next dev",
+ "dev": "next dev --webpack",
"build": "next build",
"start": "next start",
"lint": "eslint"
diff --git a/ai_agents/AI-Voice-Agent/server/main.py b/ai_agents/AI-Voice-Agent/server/main.py
index da65405..3b8378b 100644
--- a/ai_agents/AI-Voice-Agent/server/main.py
+++ b/ai_agents/AI-Voice-Agent/server/main.py
@@ -284,6 +284,9 @@ async def websocket_endpoint(websocket: WebSocket):
while True:
# Wait for data from client
message = await websocket.receive()
+ if message.get("type") == "websocket.disconnect":
+ print("Client disconnected")
+ break
if "bytes" in message:
data = message["bytes"]
if not agent_speaking: