Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this pageProducts used
Looking for more inspiration?Visit the
Error
Application error

31924: Stream - Websocket - Protocol Error

Twilio Voice DocumentationVoice

Description

description page anchor

Twilio returns this error when your WebSocket server sends a malformed message or otherwise does not follow the WebSocket protocol during a Voice Media Stream.

Possible causes

possible-causes page anchor
  • The WebSocket control frame was fragmented.
  • A message sent by your server did not conform to the WebSocket protocol.
  • In a bidirectional Stream, your server sent a message back to Twilio that was not a supported media, mark, or clear message, or the message format was invalid.
  • Verify the messages sent by your server.
  • If you use bidirectional Media Streams with <Connect><Stream>, send only supported media, mark, and clear messages back to Twilio.
  • When sending a media message, encode the payload as base64 audio/x-mulaw audio at 8000 Hz and do not include audio file header bytes.
  • If you started a unidirectional Stream with <Start><Stream>, do not send audio or control messages back to Twilio over the WebSocket connection.

Additional resources

additional-resources page anchor