feat(plugins): add Gnani STT#1585
Conversation
🦋 Changeset detectedLatest commit: aad44b8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 34 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| } catch (error) { | ||
| if (error instanceof APIConnectionError || error instanceof APIStatusError) throw error; | ||
| if (error instanceof APITimeoutError) throw error; | ||
| throw new APIConnectionError({ message: `Gnani STT WebSocket error: ${error}` }); | ||
| } finally { | ||
| this.closed = true; | ||
| } |
There was a problem hiding this comment.
🔴 WebSocket resource leak when handshake phase fails before send/recv tasks start
When #waitForConnectedMessage fails (e.g. 10-second timeout at line 320-323, JSON parse error at line 357, or a WebSocket error/close event), the error propagates directly to the outer catch at line 277, bypassing the inner finally block (lines 273-276) that contains the only ws.close() call. The WebSocket was successfully opened by #waitForOpen but is never closed.
On each retry by the base class mainTask() (agents/src/stt/stt.ts:284-327), a new WebSocket is created, leaking the previous one. With the default maxRetry: 3, up to 4 open WebSocket connections can be leaked per stream if the server consistently fails the handshake phase.
| } catch (error) { | |
| if (error instanceof APIConnectionError || error instanceof APIStatusError) throw error; | |
| if (error instanceof APITimeoutError) throw error; | |
| throw new APIConnectionError({ message: `Gnani STT WebSocket error: ${error}` }); | |
| } finally { | |
| this.closed = true; | |
| } | |
| } catch (error) { | |
| ws.close(); | |
| if (error instanceof APIConnectionError || error instanceof APIStatusError) throw error; | |
| if (error instanceof APITimeoutError) throw error; | |
| throw new APIConnectionError({ message: `Gnani STT WebSocket error: ${error}` }); | |
| } finally { | |
| this.closed = true; | |
| } |
Was this helpful? React with 👍 or 👎 to provide feedback.
We have integrated Gnani's Speech-to-Text with LiveKit Agents. The service provides low-latency, high-accuracy transcription for Indian languages and accents, supporting English (Indian), Hindi, Tamil, Telugu, and more. It offers secure API key–based authentication and real-time transcription optimized for conversational and voice-based applications.