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
unknown
codemeaningnext action
1000Normal ClosureNormal end. Do not auto-retry; wait for an explicit or specified resume condition.
1001Going AwayPeer or page is leaving. Confirm a resume or reconnect condition before retrying.
1006Abnormal ClosureUnexpected failure. Confirm need, then use a bounded retry with backoff and observation.
1011Internal ErrorPeer-side processing failure. Use a capped retry and investigate; never loop forever.
Unknown valueDo not auto-retry. Stop and verify the received value, specification and implementation.

Safe review order

  1. Record the close code and who owns the connection.
  2. Separate normal closure from temporary failure and state retry conditions.
  3. Set backoff and a cap whenever retry is allowed.
  4. 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

casefixed valuedecision
normal-close-10001000normal end; do not retry
going-away-10011001confirm resume condition, then retry
abnormal-close-10061006bounded retry with backoff
server-error-10111011capped retry and investigate
unknown-close-codeunknownstop and inspect; no automatic retry