Defjs
Core

StreamAwaitResult

Await-result tuple from opening an SSE stream.

@defjs/core · Type

Signature

type StreamAwaitResult<
  TEvent,
  TError extends AnyStruct | undefined = undefined,
> =
  | [error: null, stream: EventStreamHandle<TEvent>, open: EventStreamOpenInfo]
  | [
      error: Fault<TError>,
      stream: undefined,
      open: EventStreamOpenInfo | undefined,
    ];
  • On success: [null, stream, open]. open is the returned connection's first successful handshake snapshot for native Defjs handles or wrappers forwarding the same live open object; custom handles or wrappers overriding open use their current public open even after reconnect, while stream.open stays live.

  • On failure: [fault, undefined, open]. open carries the response snapshot when the failure happened after a response arrived, for example a non-2xx handshake, and is undefined otherwise.

  • TError is the declared error struct. It types the decoded error body on the fault.

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