Commit fe899a8
fix: switch voice AI from broken WebSocket path to ElevenLabs LiveKit WebRTC
Remove the custom signed-URL Netlify webhook and pass agentId directly to
useConversation.startSession(). This triggers the SDK's modern LiveKit
WebRTC path instead of the legacy WebSocket path to api.elevenlabs.io.
The WebSocket path (signedUrl) was causing repeated
'WebSocket is already in CLOSING or CLOSED state'
errors from onInputWorkletMessage — the audio worklet kept firing after
the server closed the socket without the client realising it.
With agentId, ElevenLabs SDK fetches its own LiveKit JWT from
/v1/convai/conversation/token and connects via WebRTC — no custom
server function or signed-URL proxy needed.
Requirement: VITE_ELEVENLABS_AGENT_ID must be set in Netlify env vars
(VITE_ prefix so Vite bundles it into the frontend build). The agent
must have public access enabled in the ElevenLabs dashboard.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 57cefac commit fe899a8
1 file changed
+17
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | 123 | | |
125 | 124 | | |
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
129 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
130 | 135 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
139 | 139 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 140 | + | |
146 | 141 | | |
147 | 142 | | |
148 | 143 | | |
149 | | - | |
| 144 | + | |
150 | 145 | | |
151 | 146 | | |
152 | 147 | | |
153 | 148 | | |
154 | 149 | | |
155 | 150 | | |
156 | 151 | | |
157 | | - | |
| 152 | + | |
158 | 153 | | |
159 | 154 | | |
160 | 155 | | |
| |||
0 commit comments