@ryandur/sand
    Preparing search index...

    Function connecting

    • connecting('wss://example.test/live', () => 'unreachable')
      .onSuccess(socket => socket.addEventListener('message', receive));

      connecting guards the handshake — the one exchange a socket settles. The open connection comes back whole: message policy stays with the caller, where it belongs. The chain owns the teardown: cancel closes the socket, whether the handshake is still in flight or long since landed.

      Type Parameters

      • ERROR

      Parameters

      • url: string | URL
      • onError: (thrown: unknown) => ERROR
      • Optionalprotocols: string | string[]

      Returns Result.Async<WebSocket, ERROR>