Skip to content

HttpRpcClient

Defined in: src/client/connect.ts:92

An HTTP-connected RPC client: RpcClient plus the HTTP-only continuation-resume surface.

beginSession(token?): void;

Defined in: src/client/connect.ts:140

Enter a sticky-session scope on this connection.

Every subsequent request carries VGI-Session-Accept: true (the server-side opt-in), the session token once the server has minted one, and any VGI-Echo-<name> headers the server asked to have echoed back — which is how a session survives a load balancer that has no cookie to work with. Pass token to resume a session the server already holds.

Scoped, not permanent: HttpRpcClient.endSession closes it.

Parameter Type
token? string | null

void


call(method, params?): Promise<Record<string, any> | null>;

Defined in: src/client/connect.ts:56

Invoke a unary method. Returns the single result row, or null for void methods. Parameter defaults from the server’s description are applied automatically.

Parameter Type
method string
params? Record<string, any>

Promise<Record<string, any> | null>

RpcClient.call


callRaw(method, input): Promise<RawBatch | null>;

Defined in: src/client/connect.ts:72

Invoke a unary method from an already-encoded request batch.

The batch-level twin of RpcClient.call, for a caller that holds encoded Arrow rather than values: input crosses verbatim (schema, buffers and custom metadata alike), and the reply comes back as the server encoded it. Resolves to null when the method returns nothing.

input.metadata is the call’s dispatch metadata and must already carry vgi_rpc.method and vgi_rpc.protocol; nothing here supplies a default for either. Unlike RpcClient.call this applies no parameter defaults and needs no introspection round trip.

Parameter Type
method string
input RawBatch

Promise<RawBatch | null>

RpcClient.callRaw


capabilities(): Promise<HttpServerCapabilities>;

Defined in: src/client/connect.ts:126

Discover what this server advertises on OPTIONS {prefix}/health.

Promise<HttpServerCapabilities>


close(): void;

Defined in: src/client/connect.ts:88

Release transport resources; for subprocess clients this also terminates the child process.

void

RpcClient.close


currentEchoHeaders(): Record<string, string>;

Defined in: src/client/connect.ts:147

The VGI-Echo-* values captured when the session opened, keyed by the header name to replay them under. Empty when there are none.

Record<string, string>


currentSessionToken(): string | null;

Defined in: src/client/connect.ts:142

The session token in flight, or null when no session is open.

string | null


describe(): Promise<ServiceDescription>;

Defined in: src/client/connect.ts:86

Fetch the server’s method/protocol description (cached after the first call).

Promise<ServiceDescription>

RpcClient.describe


detachSession(): string | null;

Defined in: src/client/connect.ts:153

Hand the session token to the caller and stop tracking it, so HttpRpcClient.endSession leaves the server-side session alive for a later HttpRpcClient.beginSession to resume.

string | null


endSession(): Promise<void>;

Defined in: src/client/connect.ts:158

Leave the sticky-session scope, closing the server-side session with a best-effort DELETE {prefix}/__session__ unless it was detached.

Promise<void>


requestUploadUrls(count?): Promise<UploadUrlPair[]>;

Defined in: src/client/connect.ts:128

Ask the server for count pre-signed upload/download URL pairs.

Parameter Type
count? number

Promise<UploadUrlPair[]>


resumeStream(
method,
token,
outputSchema?
): Promise<HttpStreamSession>;

Defined in: src/client/connect.ts:118

Resume a producer stream from a continuation token without re-binding.

A continuation request (POST /{method}/exchange carrying only the STATE_KEY token) is fully self-describing: the server recovers the producer state, schemas, and function identity from the signed token alone, so no bind/init round-trip is needed. This is the cheap path for a stateless relay that holds a per-batch token (see HttpStreamSession.nextWithToken) and resumes on any connection/node — unlike stream(...) which would produce and discard a fresh first turn before seeking.

token is the opaque blob from HttpStreamSession.nextWithToken, which packs both the cursor and the call token; the resuming node may never have seen this stream’s /init, so it needs both.

The returned session is positioned at token; the first nextWithToken() (or iteration) issues the continuation. outputSchema is unused on the producer-continuation path (each response’s IPC stream carries its own schema) and defaults to the empty schema.

Mirrors Python’s _HttpProxy.resume_stream.

Parameter Type
method string
token string
outputSchema? Schema<any>

Promise<HttpStreamSession>


stream(method, params?): Promise<HttpStreamSession>;

Defined in: src/client/connect.ts:94

Open a streaming method, returning an HttpStreamSession for exchange or producer iteration.

Parameter Type
method string
params? Record<string, any>

Promise<HttpStreamSession>

RpcClient.stream


streamRaw(
method,
input,
options
): Promise<HttpStreamSession>;

Defined in: src/client/connect.ts:120

Open a streaming method from an already-encoded request batch.

Parameter Type
method string
input RawBatch
options { hasHeader: boolean; isExchange: boolean; }
options.hasHeader boolean
options.isExchange boolean

Promise<HttpStreamSession>

RpcClient.streamRaw