# WebSocket close frame received with status code 1006 (abnormal closure)

- **ID:** `communication/websocket-1006-abnormal-closure`
- **Domain:** communication
- **Category:** connection_error
- **Error Code:** `1006`
- **Verification:** ai_generated
- **Fix Rate:** 70%

## Root Cause

WebSocket connection terminated unexpectedly without a close frame, typically due to network failure, proxy timeout, or server crash.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| RFC 6455 | active | — | — |
| WebSocket++ 0.8.2 | active | — | — |
| ws 8.16 | active | — | — |
| Node.js 20 | active | — | — |

## Workarounds

1. **Implement automatic reconnection with exponential backoff on the client. When a 1006 closure is detected, wait 1s, 2s, 4s, etc., before reconnecting. Log the event to diagnose network stability.** (80% success)
   ```
   Implement automatic reconnection with exponential backoff on the client. When a 1006 closure is detected, wait 1s, 2s, 4s, etc., before reconnecting. Log the event to diagnose network stability.
   ```
2. **Check proxy and load balancer settings for WebSocket timeout. On NGINX, ensure proxy_read_timeout is set high (e.g., 3600s) and proxy_http_version is 1.1 with Connection upgrade.** (75% success)
   ```
   Check proxy and load balancer settings for WebSocket timeout. On NGINX, ensure proxy_read_timeout is set high (e.g., 3600s) and proxy_http_version is 1.1 with Connection upgrade.
   ```

## Dead Ends

- **Increase the WebSocket ping/pong interval on the client** — 1006 is not a timeout error; it's an abnormal closure where no close frame is sent. Ping/pong intervals only help with idle timeouts, not sudden disconnections (70% fail)
- **Disable SSL/TLS on the WebSocket connection** — 1006 can occur over both ws:// and wss://; disabling encryption does not prevent network-level drops (85% fail)
- **Switch from WebSocket to long polling as a workaround** — Long polling introduces different failure modes and does not fix the root cause of unstable WebSocket connections (90% fail)
