# WebSocket frame exceeds maximum size: received 1048576 bytes, max allowed 65536 bytes (Error code 1009)

- **ID:** `communication/websocket-1009-message-too-big`
- **Domain:** communication
- **Category:** protocol_error
- **Error Code:** `1009`
- **Verification:** ai_generated
- **Fix Rate:** 84%

## Root Cause

WebSocket server or client closes connection with code 1009 because the received message payload exceeds the configured maximum frame size, typically due to unsplit large payloads or misconfigured limits.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| RFC 6455 | active | — | — |
| Node.js ws library 8.12.0 | active | — | — |
| Python websockets 12.0 | active | — | — |
| Go gorilla/websocket 1.5.0 | active | — | — |

## Workarounds

1. **Implement message splitting on the sender: break large payloads (e.g., > 64KB) into multiple WebSocket messages with a sequence identifier, then reassemble on the receiver. This avoids exceeding the frame limit.** (90% success)
   ```
   Implement message splitting on the sender: break large payloads (e.g., > 64KB) into multiple WebSocket messages with a sequence identifier, then reassemble on the receiver. This avoids exceeding the frame limit.
   ```
2. **Increase the server's max frame size (e.g., in Python websockets: set 'max_size' parameter to None or a larger value like 10MB).** (85% success)
   ```
   Increase the server's max frame size (e.g., in Python websockets: set 'max_size' parameter to None or a larger value like 10MB).
   ```
3. **Use compression (e.g., permessage-deflate extension) to reduce payload size below the limit, if both client and server support it.** (80% success)
   ```
   Use compression (e.g., permessage-deflate extension) to reduce payload size below the limit, if both client and server support it.
   ```

## Dead Ends

- **** — Increasing the max frame size on the client only shifts the problem; the server may still enforce a smaller limit, causing asymmetric failures. (60% fail)
- **** — Disabling fragmentation entirely (e.g., setting 'permessage-deflate' off) doesn't reduce payload size and may not be supported by all libraries. (75% fail)
- **** — Switching to a different WebSocket library without adjusting limits often results in the same default cap (e.g., 65536 bytes in many implementations). (70% fail)
