31920: Stream - WebSocket - Handshake Error
VOICE
ERROR
Twilio returns this error when your Media Stream endpoint responds to the WebSocket connection request with an HTTP status other than 101. In most cases, the URL in <Stream> did not complete a valid WebSocket upgrade.
- The destination server does not support WebSocket connections.
- The WebSocket protocol is not enabled for the requested URL.
- The
<Stream>urlpoints to the wrong path for your WebSocket server, so the server returns a non-101 response instead of upgrading the connection. - The
<Stream>urlincludes query string parameters.<Stream>does not support query strings, which can cause your application to reject the request.
- Verify that your server and framework are configured to accept WebSocket connections on the destination route.
- Verify that the path in your TwiML points to the exact endpoint that handles the WebSocket upgrade.
- Use
wssin the<Stream>url. Twilio supports onlywssfor Media Streams. - Remove query string parameters from the
<Stream>url. Use nested<Parameter>nouns to pass custom values instead. - Set
statusCallbackon<Stream>so you can reviewStreamErrordetails when the stream fails to start.