Skip to contentSkip to navigationSkip to topbar
Page toolsOn this pageProducts used
Looking for more inspiration?Visit the

31920: Stream - WebSocket - Handshake Error


ERROR: 31920

error-31920 page anchor
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.

Possible causes

possible-causes page anchor
  • The destination server does not support WebSocket connections.
  • The WebSocket protocol is not enabled for the requested URL.
  • The <Stream> url points to the wrong path for your WebSocket server, so the server returns a non-101 response instead of upgrading the connection.
  • The <Stream> url includes 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 wss in the <Stream> url. Twilio supports only wss for Media Streams.
  • Remove query string parameters from the <Stream> url. Use nested <Parameter> nouns to pass custom values instead.
  • Set statusCallback on <Stream> so you can review StreamError details when the stream fails to start.

Additional resources

additional-resources page anchor