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].openis the returned connection's first successful handshake snapshot for native Defjs handles or wrappers forwarding the same liveopenobject; custom handles or wrappers overridingopenuse their current publicopeneven after reconnect, whilestream.openstays live. -
On failure:
[fault, undefined, open].opencarries the response snapshot when the failure happened after a response arrived, for example a non-2xx handshake, and isundefinedotherwise. -
TErroris the declarederrorstruct. It types the decoded error body on the fault.