Description
When sending WebSocket close frames with a description field, Chrome and Brave browsers receive malformed data, while Firefox handles it correctly. The malformation is inconsistent but appears to be related to the close frame's description field encoding.
Reproduction
- Set up a WebSocket proxy using actix-ws
- Send a close frame with description:
session.close(Some(CloseReason {
code: CloseCode::Normal,
description: Some("Search completed".to_string())
})).await
Chrome (has malformed data):

- This one has spaces at the start which makes the response a invalid json
Firefox(no malformed data):
- Observe in Chrome/Brave:
- Malformed data appears:
[malformed] 464b85aa11a4e270e81866] Search completed...
- Issue is inconsistent but reproducible
- Firefox receives frames correctly
Current Workaround
Skipping the description field in close frames resolves the issue:
session.close(Some(CloseReason {
code: CloseCode::Normal,
description: None // Skip description to avoid malformation
})).await
Environment
- actix-ws: 0.2.5
- Chrome/Brave (Chromium-based browsers)