cool-lizard-26153
05/12/2026, 7:17 AMtall-airline-16756
05/12/2026, 7:17 AMtall-airline-16756
05/12/2026, 7:18 AMcool-lizard-26153
05/12/2026, 7:28 AMlivekit-plugins-elevenlabs==1.5.1
livekit == 1.1.3
elevenlabs.TTS(
voice_id=selectedVoice,
model=config['elevenLabs.model'],
voice_settings=voiceSettingsObj,
enable_ssml_parsing=True
)
to iniializetall-airline-16756
05/12/2026, 7:29 AMclose() if exposed) and wait for confirmation.
• Add explicit try/except around the streaming call and log exceptions and finalization steps (open, send start, send end, close).
• Add short lifecycle logs around connect/send/close with timestamps so we can see whether the remote closed unexpectedly.
• If there’s an intermediate proxy/load balancer, enable TCP/HTTP keepalives or lower idle timeouts to prevent intermediates from dropping the socket.
• Reproduce with verbose network logging (or run locally) to see whether the socket is closed by the server or by an intermediate.
What I can do once you share the code + logs
• Review the synth/stream and close sequence for missing awaits or abrupt termination.
• Suggest exact code changes (where to add await/close and logging) for livekit-plugins-elevenlabs==1.5.1 + livekit==1.1.3.
• Recommend further network-level checks if the close appears to be caused by an intermediate.
Send the synth/stream + close code and a short log excerpt and I’ll review.
Sources: ElevenLabs TTS | LiveKit Documentation, with interactive elementscool-lizard-26153
05/12/2026, 10:22 AMtall-airline-16756
05/12/2026, 10:22 AM--log-level=DEBUG
◦ Env var: LIVEKIT_LOG_LEVEL=DEBUG before starting the agent
(These will surface broader runtime and networking details that may include ElevenLabs interactions.)
• Add explicit logging around the ElevenLabs calls in your worker using Python’s `logging`:
◦ Log connection open, send/start-of-stream, end-of-stream, and close events and any caught exceptions.
◦ Example:
import logging
logger = logging.getLogger("elevenlabs")
logger.setLevel(logging.DEBUG)
try:
logger.debug("Starting TTS synth...")
# call into elevenlabs TTS
logger.debug("TTS synth finished, closing stream")
except Exception as e:
logger.exception("ElevenLabs TTS error")
• Check network factors: proxies, load balancers, or TCP idle timeouts can cause WebSocket 1006; enabling keepalives or lowering idle timeouts may help.
If you want, paste a short log snippet or the synth/close code and I’ll point out where to add logging or what to look for in the debug output.
Sources: ElevenLabs TTS | LiveKit Documentation | Server options | LiveKit Documentation | Ultravox plugin guide | LiveKit Documentation | Where to find your Agent Logs | LiveKit, with interactive elements