31902: Stream - WebSocket - Connection Refused
VOICE
ERROR
Twilio returns this error when a Media Stream cannot establish a WebSocket connection because the destination host refuses the connection request. Media Streams use the <Stream> noun and connect to your endpoint over wss.
- The
urlin<Start><Stream>or<Connect><Stream>, or theUrlused with the Stream resource, points to the wrong host, path, or port. - Your WebSocket server is down, not listening, or otherwise unavailable when Twilio tries to connect.
- Your network or firewall is blocking secure WebSocket traffic to your server. Media Streams require secure WebSocket connections on TCP port 443 from Twilio to your WebSocket server.
- The endpoint is not accepting a secure
wssconnection. Twilio supportswssfor Media Streams.
- Verify that the Media Stream destination is the correct
wssendpoint and that the host, path, and port are correct in your<Stream>urlor Stream resourceUrl. - Confirm that your WebSocket server process is running and able to accept incoming connections when the call starts the stream.
- Update your firewall or network rules to allow secure WebSocket connections on TCP port 443 from Twilio to your WebSocket server.
- If the refusal was caused by a temporary service interruption, retry the connection after your WebSocket service is healthy again.