Hi @Ashir Baig
Thanks for clearly describing the issue. I understand that this timeout is impacting your production service, and it can be very frustrating, especially when everything else appears to be working well.
Most Likely Cause:
With replicas enabled, such as your secondary setup, clients should connect only to the primary endpoint: wss://connectlingua-jp-pubsub-prod.webpubsub.azure.com/client/hubs/myhub?access_token=...
Connecting to the secondary replica endpoint (connectlingua-jp-pubsub-sec-prod) will always result in an ETIMEDOUT error.
Quick Diagnostic Steps :
- Check the endpoint: Make sure your app code is using the primary FQDN above and not "sec-prod."
- Test connectivity: Try connecting from your client machine or server.
npm install -g wscat
wscat -c "wss://connectlingua-jp-pubsub-prod.webpubsub.azure.com/client/hubs/myhub?access_token=YOUR_TOKEN"
- Check networking: Portal >Web PubSub > Networking > Access Restrictions > Allow "All networks" temporarily
- Enable Live Trace: Portal >Monitoring > Live Trace >Enable > Try connecting >Check for events
Expected Results:
- If
wscat connects successfully, the endpoint is healthy — this means the issue is in your client application code. You should fix your app’s connection string.
- If
wscat times out, there is a network blockage preventing the connection. You should check your firewall or proxy settings, especially ensuring port 443 is open.
- If Live Trace is empty, the request is not reaching Azure at all. This indicates a client-side network or proxy block, so review your network rules or proxy configuration.
- If Live Trace shows events, Azure is receiving the connection attempts. At this point, you should check your authentication token and application logs, because the issue is likely related to auth or app logic.
Below are the most common reasons this occurs and how to isolate them.
Reasons for Intermittent Connection Success and Timeouts Network Instability (firewall, proxy, VPN, ZTNA, TLS inspection): WebSockets need a steady outbound route over port 443. If a firewall or proxy sometimes delays or blocks the TLS/WebSocket handshake, those attempts may fail with ETIMEDOUT.
Network access control & outbound requirements: https://learn.microsoft.com/azure/azure-web-pubsub/howto-secure-network-access-control Token Expiry or Reuse Under Load:
If several clients use a short-lived or soon-to-expire access token, some connections may succeed while others fail at handshake. Authentication and token behavior: https://learn.microsoft.com/azure/azure-web-pubsub/howto-troubleshoot-common-issues#authentication-…
Client-Side Connection Surges and Throttling:
If many connections are started at once, handshake processes may slow down and hit timeout limits.
Connection count / throttling rules https://learn.microsoft.com/azure/azure-web-pubsub/concepts-service-constraints
Recommended Steps for Determining the Root Cause
Conduct multiple connectivity tests using wscat from the same client environment
This approach helps determine if the issue is related to the client network:
Knowledge base
npm install -g wscat
wscat -c "wss://connectlingua-jp-pubsub-prod.webpubsub.azure.com/client/hubs/myhub?access_token=YOUR_FRESH_TOKEN"
If the results are inconsistent, such as 5 out of 10 being successful, this indicates that the network path is unstable.
Enable Live Trace and compare successful and failed attempts from Portal > Web PubSub > Monitoring > Live Trace
Check for:
- No events at all – the client did not reach Azure, possibly due to a network or proxy block
- PingTimeout / SlowClient – handshake is taking too long on the client side
- Authentication errors – token may be close to expiration
Reference:
https://learn.microsoft.com/en-us/azure/azure-web-pubsub/howto-troubleshoot-resource-logs
https://learn.microsoft.com/en-us/azure/azure-web-pubsub/howto-enable-geo-replication?tabs=Portal
https://learn.microsoft.com/en-us/azure/azure-web-pubsub/howto-troubleshoot-common-issues
https://learn.microsoft.com/en-us/azure/azure-web-pubsub/howto-troubleshoot-resource-logs
https://learn.microsoft.com/en-us/azure/azure-web-pubsub/howto-secure-network-access-control?tabs=azure-portal
Kindly let us know if the above helps or you need further assistance on this issue.
Please "upvote" if the information helped you. This will help us and others in the community as well.