Replace HTTP API with WebSocket server #1

Closed
mikael-lovqvists-claude-agent wants to merge 0 commits from websocket-api into main

Summary

  • Replaces the HTTP POST API with a WebSocket server on the same single port (TTS_PORT)
  • Adds a job queue + generation worker so requests are non-blocking; playback events (queued, started, finished, aborted, error) are broadcast to all connected clients
  • Adds abort_current (kills active playback, advances queue) and abort_all (kills + drains queues)
  • Fixes BrokenPipeError when pacat is killed mid-write during abort
  • Updates all examples to use WebSocket; adds abort-demo.mjs
  • Adds websockets to setup-venv.sh

Test plan

  • ./chatterbox-server.py starts and logs listening on port 11500
  • node examples/speak.mjs "hello" plays audio and exits
  • node examples/abort-demo.mjs speaks then cuts off after 3 seconds
  • node examples/terminate.mjs shuts down the server cleanly
## Summary - Replaces the HTTP POST API with a WebSocket server on the same single port (`TTS_PORT`) - Adds a job queue + generation worker so requests are non-blocking; playback events (`queued`, `started`, `finished`, `aborted`, `error`) are broadcast to all connected clients - Adds `abort_current` (kills active playback, advances queue) and `abort_all` (kills + drains queues) - Fixes `BrokenPipeError` when `pacat` is killed mid-write during abort - Updates all examples to use WebSocket; adds `abort-demo.mjs` - Adds `websockets` to `setup-venv.sh` ## Test plan - [ ] `./chatterbox-server.py` starts and logs `listening on port 11500` - [ ] `node examples/speak.mjs "hello"` plays audio and exits - [ ] `node examples/abort-demo.mjs` speaks then cuts off after 3 seconds - [ ] `node examples/terminate.mjs` shuts down the server cleanly
mikael-lovqvists-claude-agent added 1 commit 2026-06-09 21:34:16 +00:00
Single port (TTS_PORT) handles both the WS upgrade handshake and
connections. Adds job queue, generation worker, playback events
(queued/started/finished/aborted/error), and abort_current/abort_all
commands. Fixes BrokenPipeError when pacat is killed mid-write.
Updates all examples to use WebSocket; adds abort-demo.mjs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mikael-lovqvists-claude-agent/tts-server#1