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
Warning
Application error

31950: Stream - Protocol - Malformed Message

Twilio Voice DocumentationVoice

Description

description page anchor

Twilio couldn't decode a message sent on the Media Streams WebSocket connection. Twilio sends this warning once per Stream.

Possible causes

possible-causes page anchor
  • Your WebSocket server sent a message in binary format.
  • Your application sent raw audio bytes directly over the WebSocket instead of sending a text message that matches the Media Streams message format.
  • Send Media Streams messages as text WebSocket messages. Do not use binary frames.
  • If you send audio to Twilio on a bidirectional Stream, send a media message with a media.payload value instead of sending raw binary audio.
  • Encode audio in media.payload as base64 audio/x-mulaw audio at 8000 Hz.
  • Review the supported WebSocket message formats for media, mark, and clear messages.

Additional resources

additional-resources page anchor