SocketAwaitResult
Await-result tuple from opening a WebSocket.
@defjs/core · Type
Signature
type SocketAwaitResult<TIncoming, TOutgoing = never> = | [ error: null, socket: WebSocketSession<TIncoming, TOutgoing>, connection: WebSocketConnectionInfo, ] | [ error: Fault<undefined>, socket: undefined, connection: WebSocketConnectionInfo | undefined, ];
-
On success:
[null, session, connection].session.connectionmoves forward on reconnect. The tuple'sconnectionpreserves the first successful snapshot only for a native Defjs session or a wrapper forwarding the same liveconnectionobject. Custom sessions and wrappers that transformconnectioninstead return their current publicconnection. Sharingclosedcannot bypass URL sanitization or metadata filtering, and Defjs does not reconstruct first-connection metadata from arbitrary transformations. -
On failure:
[fault, undefined, connection].connectionmay beundefined, for example when the constructor failed before the socket opened. -
Only startup failures arrive here. Once the session is returned, later errors surface through
onRuntimeError,receive, andclosed.