# 31950: Stream - Protocol - Malformed Message

Log Type: APPLICATION

Log Level: WARNING

## Description

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

### Possible causes

* 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.

### Possible solutions

* 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

* [Media Streams WebSocket messages](/docs/voice/media-streams/websocket-messages)
* [Media Streams overview](/docs/voice/media-streams)
* [TwiML Voice: `<Stream>`](/docs/voice/twiml/stream)
