31901: Stream - WebSocket - Connection Timeout
VOICE
ERROR
Twilio returns this error when the Media Stream connection request does not receive a response from your WebSocket server. Twilio uses the url in <Stream> to establish a secure wss connection, and your Media Streams application must allow secure WebSocket traffic on TCP port 443.
- Your WebSocket server is not connected to a network or is otherwise unreachable.
- The
urlin<Stream>points to the wrong host or IP address. Twilio uses thaturlto open the WebSocket connection. - An intermediate service such as ngrok, a proxy, or another routing layer is not forwarding traffic to your WebSocket server.
- A firewall or network policy is blocking secure WebSocket traffic on TCP port 443.
- Confirm that your WebSocket server is online, connected to the network, and reachable from Twilio.
- Verify that the
<Stream>urlis correct and useswss.wssis the only supported protocol for Media Streams. - If you use ngrok, a proxy, or another intermediate service, verify that it routes traffic to your WebSocket server and returns a response.
- Update your firewall rules to allow secure WebSocket connections on TCP port 443 from Twilio to your WebSocket server.
- After you restore connectivity, confirm that your server receives Twilio's initial
connectedevent on the WebSocket connection.