Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

Utils unstable

Buffers RPC protocol messages until their receive loop starts.

2 exports Since v4.0.0 Source

Services

withRun

unstable
Since v4.0.0

Buffers writes until run replays them with their original contexts and installs the writer. Restores the previous writer when run ends.

Signature

declare function withRun<A extends {
readonly run: (f: (...args: Array<any>) => Effect<void>) => Effect<never>;
}>(): <EX, RX>(f: (write: Parameters<A["run"]>[0]) => Effect<Omit<A, "run">, EX, RX>) => Effect<A, EX, RX>
Since v4.0.0

Builds an RPC client protocol service that tracks active client IDs and buffers server responses per client until that client's run handler is installed.

Signature

declare function withRunClient<EX, RX>(f: (write: (clientId: number, response: FromServerEncoded) => Effect<void>, clientIds: ReadonlySet<number>) => Effect<Omit<{
readonly codecFor: CodecFor;
readonly run: (clientId: number, f: (data: FromServerEncoded) => Effect<void>) => Effect<never>;
readonly send: (clientId: number, request: FromClientEncoded, transferables?: readonly Array<Transferable>) => Effect<void, RpcClientError>;
readonly supportsAck: boolean;
readonly supportsTransferables: boolean;
}, "run">, EX, RX>): Effect<{
readonly codecFor: CodecFor;
readonly run: (clientId: number, f: (data: FromServerEncoded) => Effect<void>) => Effect<never>;
readonly send: (clientId: number, request: FromClientEncoded, transferables?: readonly Array<Transferable>) => Effect<void, RpcClientError>;
readonly supportsAck: boolean;
readonly supportsTransferables: boolean;
}, EX, RX>