Defjs
Core

SocketLifecycleOutcome

The outcome of a single connect attempt, not the final result of the session.

@defjs/core · Type

Signature

type SocketLifecycleOutcome = {
  closeInfo: WebSocketCloseSnapshot;
  connection?: WebSocketConnectionInfo;
  cause?: unknown;
  opened: boolean;
};

The reconnect logic uses it to decide whether to try again.

  • closeInfo holds the close details of that attempt: { cause?, code?, reason?, wasClean? }.

  • connection is the connection snapshot, when the attempt got one.

  • cause is the error that ended the attempt, if any.

  • opened tells whether the socket reached open before it ended.

The shouldReconnect option does not receive this object. It gets attempt, cause, code, reason, and wasClean, taken from it. The final result of the session is WebSocketCloseInfo.

Members

Prop

Type

closeInfo WebSocketCloseSnapshot
connection? WebSocketConnectionInfo | undefined
cause? unknown
opened boolean
Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao