Defjs
Core

EventStreamCloseInfo

How an SSE stream ended: clean EOF, abort, or an error carrying its fault code.

@defjs/core · Type

Signature

type EventStreamCloseInfo =
  | (EventStreamCloseInfoBase & { kind: "eof" })
  | (EventStreamCloseInfoBase & { kind: "aborted" })
  | (EventStreamCloseInfoBase & { code: EventStreamFaultCode; kind: "error" });

The discriminant is kind so that code can mean the same thing it means on a fault.

The value of EventStreamHandle.closed. eof means the response ended normally. aborted means the stream was closed with close() or disposal, or its caller signal aborted with a non-timeout reason; reason and cause carry the value passed to close. If the caller signal aborts after open with a TimeoutError or ERR_TIMEOUT, the iterator throws ERR_TIMEOUT and closed is { kind: 'error', code: 'NET_TIMEOUT', ... }. Explicit close(timeoutError) still reports aborted. error carries the fault code (see EventStreamFaultCode) and the failure as cause.

Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao