# WebSocket close code 1006: Abnormal Closure

- **ID:** `api/websocket-close-code-1006-abnormal-closure`
- **Domain:** api
- **Category:** network_error
- **Error Code:** `1006`
- **Verification:** ai_generated
- **Fix Rate:** 70%

## Root Cause

The WebSocket connection was closed unexpectedly without a normal close frame, often due to network issues, proxy timeouts, or server crash.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| WebSocket RFC 6455 | active | — | — |
| ws library v8.16 | active | — | — |
| Node.js v20 | active | — | — |

## Workarounds

1. **Implement exponential backoff reconnection with jitter.** (85% success)
   ```
   Implement exponential backoff reconnection with jitter.
   ```
2. **Add a health check endpoint and only reconnect if server is alive.** (80% success)
   ```
   Add a health check endpoint and only reconnect if server is alive.
   ```

## Dead Ends

- **** — Reconnecting without delay may hit the same network issue or server load, causing repeated 1006 closures. (70% fail)
- **** — The error is often network-related, not a code logic bug; rewriting may not address the root cause. (80% fail)
- **** — The library is rarely the cause; the underlying TCP connection is the issue. (50% fail)
