Core
WebSocketCloseInfo
Logical terminal outcome of a WebSocket session.
@defjs/core · Type
Signature
type WebSocketCloseInfo = | { kind: "closed"; code?: number; reason?: string; wasClean?: boolean } | { kind: "aborted"; cause?: unknown; code?: number; reason?: string; wasClean?: boolean; } | { kind: "error"; cause: unknown; code?: number; reason?: string; wasClean?: boolean; };
What session.closed resolves with, once the session has ended for good.
-
closed: the session ended normally, including a manualsession.close(). -
aborted: the session was cancelled;causeis the abort reason. -
error: the session failed;causeis required. -
code,reason, andwasCleancome from the native close event when one was observed. A manualsession.close(code, reason)fillscodeandreasonwhen the close event does not.