Skip to content

docs: the timestamped TTS WebSocket stays open after most errors - #482

Merged
Kilerd merged 1 commit into
mainfrom
docs/tts-ws-error-event
Dec 3, 2026
Merged

Kilerd merged 1 commit into
mainfrom
docs/tts-ws-error-event

Conversation

@Kilerd

@Kilerd Kilerd commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Before: the AsyncAPI ErrorEvent on the WebSocket TTS with Timestamps page said "The socket closes afterwards" after any error. That is true only for some errors. After an invalid StartEvent or a missing voice reference, the session ends and the socket stays open, so you can send another StartEvent on it.

After: the ErrorEvent description (Receive > Request Error) now says:

  • After an invalid StartEvent, a missing voice reference, or another error in what you sent, the session ends but the socket stays open, so you can send another StartEvent.
  • After a concurrency refusal the socket closes, and a server-side failure can close it too.

Only the ErrorEvent text changes.

Checked: mint validate and mint broken-links give the same results as main (existing errors only). prettier --check passes on the changed file.

Preview:


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The ErrorEvent description said the socket always closes after an
error. An invalid StartEvent, a missing voice reference or another
error in what the client sent ends the session but keeps the socket
open for another StartEvent. A concurrency refusal closes it, and a
server-side failure can close it too.
@mintlify

mintlify Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hanabiaiinc 🟢 Ready View Preview Dec 3, 2026, 6:51 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3b47cba8-f71b-48ce-830b-4529e68846e9
Commits

Reviewing files that changed from the base of the PR and between 0eb7e8c and 26a8783.

Files selected for processing: 1

  • api-reference/asyncapi.yml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Kilerd
Kilerd merged commit 0500aa8 into main Dec 3, 2026
7 checks passed
@Kilerd
Kilerd deleted the docs/tts-ws-error-event branch December 3, 2026 07:19
lumpinif added a commit that referenced this pull request Dec 3, 2026
* docs: the TTS WebSocket connection stays open after finish

The spec said the server closes the connection after FinishEvent. It
does not: the connection stays open and accepts another StartEvent, as
the /v1/tts/live/with-timestamp reference already says.

* docs: describe the error event on the TTS WebSocket

/v1/tts/live answers a failed session (unknown reference_id, out-of-range
value) with {event: error, error: <message>}, sends no finish after it and
leaves the connection open. The AsyncAPI did not list ErrorEvent for ttsLive,
said the socket closes after it, and the API skill told agents that failures
arrive as finish with reason error, so a client built from either waited
forever. List ErrorEvent on ttsLive, say that no FinishEvent follows it and
that a client should end the session and close the connection, note that an
unsupported format closes the connection without an event, and make the
skill's raw WebSocket samples handle both.

* docs: TTS WebSocket errors per endpoint, handshake refusals, and sample fixes

- finish ends the synthesis session, not the connection, as in the
  connection-after-finish change this builds on.
- ErrorEvent keeps the shared payload; what happens to the connection is
  stated on each server operation (checked live on both endpoints).
- Say that a refused handshake (for example 401) returns an HTTP status with
  no event.
- Node example: treat an empty error message as a failure and write no file
  for a failed session. Python example: a text source that raises now ends
  the run with its own exception instead of waiting.

* docs: TTS WebSocket samples end on a text-source failure and write the file after finish

The Python sample caught ConnectionClosed around the whole sender, so a text
source that raised ConnectionClosed was swallowed and the sample hung. Only
writes to the Fish socket are guarded now; a text-source error ends the
receiver and reaches the caller. Both samples write to out.mp3.part and
rename it after finish. The with-timestamp endpoint guide states the same
three ways a session ends as the AsyncAPI file.

* docs: close the TTS WebSocket with code 1000; open connections between sessions are not counted

Adds to the /v1/tts/live FinishEvent the two statements #481 added to the
with-timestamp FinishEvent, in the same wording.

* docs: smallest raw TTS WebSocket examples, and connection behaviour after an error per #482

- The API skill's Python and Node examples send start, the text and stop, then
  read in one loop: audio is kept in memory, finish with reason stop writes the
  file, error / finish with reason error / a close before finish fail with the
  server's message, unknown events are ignored, the socket closes with 1000.
  One sentence points LLM streams to the SDK.
- FinishEvent no longer says exactly one per session; it lists the outcomes
  that end a session.
- ErrorEvent bullets follow the merged ErrorEvent text: after an error in what
  you sent the socket stays open for another start; a concurrency refusal
  closes it. The AsyncAPI operations point to ErrorEvent for this.
- The with-timestamp guide says only finish with reason stop is success and to
  show message on reason error.

* docs: raw TTS WebSocket examples report an empty error and the close code; note the Python SDK release gap

The Python SDK 1.8.1 waits after a standalone error event; the fix is in the SDK
repository and ships with the next release.

This branch was successfully deployed

1 active deployment
staging — 26a8783b Deployed Dec 3, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant