Azure Text to Speech Error: Unable to contact server. StatusCode: 1006,

Learn StepWise 0 Reputation points
2025-03-05T14:40:35.19+00:00

Dear all,We use azure text to speech to synthesise speech.

However, recently we keep seeing this error when using Azure Text to Speech service in our application:

Error details: Unable to contact server. StatusCode: 1006, wss://uksouth.tts.speech.microsoft.com/cognitiveservices/websocket/v1 Reason: undefined

We don't notice any issues in the azure services reported. We wonder anyone else noticed the issue? Is there a way to investiage why this happens? and how to prevent this to happen?

Thank you for the help in advance.

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,940 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Prashanth Veeragoni 1,190 Reputation points Microsoft External Staff
    2025-03-06T06:44:40.84+00:00

    Hi Learn StepWise,

    Welcome to Microsoft Q&A forum. Thanks for posting your query.

    Here I understood that you are facing Azure Text-to-Speech Error: "Unable to contact server. StatusCode: 1006"

    The 1006 error typically indicates a WebSocket connection failure between your application and Azure's Text-to-Speech service. Below are the possible causes and solutions to fix this issue:

    First thing is
    Check Network Connectivity & Firewall Settings:

    Ensure that your network, firewall, or proxy is not blocking WebSocket connections.

    Verify that port 443 (HTTPS/WebSocket) is open and accessible.

    If using a corporate network, check if your IT team has any security restrictions on WebSocket traffic.

    Try switching to a different network (e.g., mobile hotspot) and check if the issue persists.

    Validate Azure Subscription Key & Endpoint:

    If the API key used for authentication is expired, incorrect, or revoked, WebSocket connections can fail.

    Confirm that you are using the correct region-specific endpoint (e.g., uksouth, eastus).

    How:

    Go to Azure Portal → Cognitive Services → Speech Service and check if your subscription is active.

    Regenerate the key if necessary and update it in your application.

    Check Azure Service Health:

    There might be an outage or regional issue affecting the Text-to-Speech service.

    Even if the Azure status page shows no issues, some region-specific disruptions may occur.

    How:

    Visit Azure Status Page and check for outages.

    Try using a different region, like westeurope or eastus, if possible.

    WebSocket Connection Timeouts & Keep-Alive Issues:

    If the WebSocket connection is idle for too long, it may time out or be closed by the server.

    Some proxies or load balancers disconnect WebSockets after a specific duration.

    Solution:

    Implement a keep-alive mechanism by sending periodic messages to keep the connection active.

    Restart the connection if it gets disconnected unexpectedly.

    Exceeding Rate Limits or Quotas:

    Azure limits the number of requests per second for Text-to-Speech.

    If your application sends too many requests in a short period, connections may be throttled.

    Solution:

    Check Azure Quotas & Limits in the Azure Portal under Speech Services.

    Reduce the number of concurrent requests or implement rate-limiting in your application.

    Browser or Client-Side Issues:

    Some browser settings or outdated clients may not handle WebSocket connections properly.

    Ad blockers, browser extensions, or security tools could also interfere with the connection.

    Solution:

    Test the Text-to-Speech service using a different browser or device.

    Disable ad blockers or VPNs and check if the connection works.

    Hope this helps. Do let us know if you any further queries.  

    ------------ 

    If this answers your query, do click Accept Answer and Yes for was this answer helpful.

    Thank you.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.