WebSocket close code / retry boundary
Separate close-code retry boundaries
Use fixed cases for 1000, 1001, 1006, 1011 and unknown values to choose whether to retry, wait, investigate or stop. No connection is opened, and this page does not communicate, store or send.
Five close-code boundaries
A close code is not a universal retry command. Separate connection ownership, retry conditions and the next action shown to a user.
1000 = normal / 1006 = abnormal / unknown = stop and inspect
| code | meaning | next action |
|---|
1000 | Normal Closure | Normal end. Do not auto-retry; wait for an explicit or specified resume condition. |
1001 | Going Away | Peer or page is leaving. Confirm a resume or reconnect condition before retrying. |
1006 | Abnormal Closure | Unexpected failure. Confirm need, then use a bounded retry with backoff and observation. |
1011 | Internal Error | Peer-side processing failure. Use a capped retry and investigate; never loop forever. |
unknownUnknown value | Do not auto-retry. Stop and verify the received value, specification and implementation. |
Safe review order
- Record the close code and who owns the connection.
- Separate normal closure from temporary failure and state retry conditions.
- Set backoff and a cap whenever retry is allowed.
- Do not guess on an unknown value; fail closed and investigate.
This page uses synthetic cases only. It does not open a connection, reconnect, communicate, store data or send analytics.
Five fixed cases
| case | fixed value | decision |
|---|
normal-close-1000 | 1000 | normal end; do not retry |
going-away-1001 | 1001 | confirm resume condition, then retry |
abnormal-close-1006 | 1006 | bounded retry with backoff |
server-error-1011 | 1011 | capped retry and investigate |
unknown-close-code | unknown | stop and inspect; no automatic retry |