Skip to content

actix-ws: Web socket Close frame description causes frame malformation in Chrome/Brave WebSocket clients #508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Loaki07 opened this issue Mar 3, 2025 · 0 comments

Comments

@Loaki07
Copy link

Loaki07 commented Mar 3, 2025

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

  1. Set up a WebSocket proxy using actix-ws
  2. Send a close frame with description:
session.close(Some(CloseReason {
    code: CloseCode::Normal,
    description: Some("Search completed".to_string())
})).await

Chrome (has malformed data):

Image - This one has spaces at the start which makes the response a invalid json Image

Firefox(no malformed data):

Image
  1. 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)
@Loaki07 Loaki07 changed the title Close frame description causes frame malformation in Chrome/Brave WebSocket clients actix-ws: Web socket Close frame description causes frame malformation in Chrome/Brave WebSocket clients Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant