← Back to Kontasks
WebSocket Console Connection Implementation
Added persistent WebSocket connection for browser-konui console
Output
WebSocket Console Connection
Replaced SSE per-request pattern with persistent WebSocket to fix disconnect cascade.
Problem Solved
When Claude hit quota exhaustion, the SSE stream cascade caused:
- Claude exits → konsole sends 'done'
- konui closes stream → browser tries reconnecting
- Request is gone → "RECONNECTING..." forever
Solution: Persistent WebSocket
Browser <--WebSocket--> Konui <--SSE--> Konsole <--stdio--> Claude
Connection stays alive regardless of turn state.
Files Created/Modified
- NEW konui/src/console-websocket.ts - Server-side WebSocket manager
- NEW konui/src/console-websocket-client.ts - Client-side WS connection
- MOD konui/src/router.ts - WS upgrade handler + prompt handler
- MOD konui/src/dashboard-console.ts - Include WS client scripts
WebSocket Endpoint
/api/console/ws?token={authToken}
Auto-reconnect with exponential backoff, heartbeat every 30s
Next Steps
Restart konui to test the WebSocket connection.
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
vibetools
Tags
consolewebsocketui
Created
8 Jan 2026, 1:11 pm
Updated
8 Jan 2026, 1:11 pm
Created By
claude
🔗 Git Commit
50d3593a
Raw Data
{
"id": "d0e509ec-0afb-45a0-8a55-aa4f97af46b2",
"type": "general",
"status": "completed",
"title": "WebSocket Console Connection Implementation",
"description": "Added persistent WebSocket connection for browser-konui console",
"context": {
"output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:'Consolas','Monaco',monospace;\"><h2 style=\"font-family:sans-serif;color:#fff;margin:0 0 16px 0;\">WebSocket Console Connection</h2><p style=\"font-family:sans-serif;color:#9ca3af;margin-bottom:16px;\">Replaced SSE per-request pattern with persistent WebSocket to fix disconnect cascade.</p><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h4 style=\"margin:0 0 12px 0;color:#fff;\">Problem Solved</h4><p style=\"color:#e0e0e0;margin:0 0 8px 0;\">When Claude hit quota exhaustion, the SSE stream cascade caused:</p><ul style=\"margin:0;padding-left:20px;color:#9ca3af;\"><li>Claude exits → konsole sends 'done'</li><li>konui closes stream → browser tries reconnecting</li><li>Request is gone → \"RECONNECTING...\" forever</li></ul></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h4 style=\"margin:0 0 12px 0;color:#fff;\">Solution: Persistent WebSocket</h4><pre style=\"margin:0;color:#98c379;\">Browser <--WebSocket--> Konui <--SSE--> Konsole <--stdio--> Claude</pre><p style=\"color:#9ca3af;margin:8px 0 0 0;\">Connection stays alive regardless of turn state.</p></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h4 style=\"margin:0 0 12px 0;color:#fff;\">Files Created/Modified</h4><ul style=\"margin:0;padding-left:20px;color:#e0e0e0;line-height:1.8;\"><li><span style=\"color:#98c379;\">NEW</span> <span style=\"color:#61afef;\">konui/src/console-websocket.ts</span> - Server-side WebSocket manager</li><li><span style=\"color:#98c379;\">NEW</span> <span style=\"color:#61afef;\">konui/src/console-websocket-client.ts</span> - Client-side WS connection</li><li><span style=\"color:#e5c07b;\">MOD</span> <span style=\"color:#61afef;\">konui/src/router.ts</span> - WS upgrade handler + prompt handler</li><li><span style=\"color:#e5c07b;\">MOD</span> <span style=\"color:#61afef;\">konui/src/dashboard-console.ts</span> - Include WS client scripts</li></ul></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h4 style=\"margin:0 0 12px 0;color:#fff;\">WebSocket Endpoint</h4><p style=\"color:#9ca3af;margin:0 0 8px 0;\"><code style=\"background:#1e1e1e;padding:2px 6px;border-radius:4px;color:#e5c07b;\">/api/console/ws?token={authToken}</code></p><p style=\"color:#9ca3af;margin:0;\">Auto-reconnect with exponential backoff, heartbeat every 30s</p></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;\"><h4 style=\"margin:0 0 8px 0;color:#fff;\">Next Steps</h4><p style=\"color:#9ca3af;margin:0;\">Restart konui to test the WebSocket connection.</p></div></div>",
"commitSha": "50d3593a",
"choices": [
{
"label": "Restart konui",
"value": "Restart konui to apply the WebSocket console changes",
"primary": true
},
{
"label": "View diff",
"value": "Show the full diff for commit 50d3593a"
},
{
"label": "Test endpoint",
"value": "Test the /api/console/ws/info endpoint to verify the WebSocket handler is working"
}
]
},
"createdBy": "claude",
"createdAt": "2026-01-08T03:11:36.612Z",
"updatedAt": "2026-01-08T03:11:36.939Z",
"scope": "vibetools",
"tags": [
"console",
"websocket",
"ui"
],
"targetUser": "claude"
}