<Self>(
node: NodeKey<Self> & {
readonly url?: string
readonly endpoints?: Endpoints
},
options?: {
readonly url?: string
readonly serialization?: Layer.Layer<RpcSerialization.RpcSerialization>
}
): Layer.Layer<Self>Wire a Node's transport over http — the server/CLI/backend case. Builds the http client
Protocol (Fetch + serialization) from a url and re-keys it under the node. Serialization defaults
to defaultSerialization (ndjson), matching httpServer's default so the two sides agree
by construction. In a browser this fails hard (HttpClientInBrowser) — http starves at the
~6-connection cap; use ws there.
const EdgeLive = Hyperlink.http(EdgeNode, { url: "http://10.0.0.2:3002/rpc" });const const http: <Self>(
node: NodeKey<Self> & {
readonly url?: string
readonly endpoints?: Endpoints
},
options?: {
readonly url?: string
readonly serialization?: Layer.Layer<RpcSerialization.RpcSerialization>
}
) => Layer.Layer<Self>
Wire a
Node
's transport over http — the server/CLI/backend case. Builds the http client
Protocol (Fetch + serialization) from a url and re-keys it under the node. Serialization defaults
to
defaultSerialization
(ndjson), matching
httpServer
's default so the two sides agree
by construction. In a browser this fails hard (HttpClientInBrowser) — http starves at the
~6-connection cap; use
ws
there.
const EdgeLive = Hyperlink.http(EdgeNode, { url: "http://10.0.0.2:3002/rpc" });
http = <function (type parameter) Self in <Self>(node: NodeKey<Self> & {
readonly url?: string;
readonly endpoints?: Endpoints;
}, options?: {
readonly url?: string;
readonly serialization?: Layer.Layer<RpcSerialization.RpcSerialization>;
}): Layer.Layer<Self>
Self>(
node: anynode: import NodeKeyNodeKey<function (type parameter) Self in <Self>(node: NodeKey<Self> & {
readonly url?: string;
readonly endpoints?: Endpoints;
}, options?: {
readonly url?: string;
readonly serialization?: Layer.Layer<RpcSerialization.RpcSerialization>;
}): Layer.Layer<Self>
Self> & { readonly url?: string | undefinedurl?: string; readonly endpoints?: anyendpoints?: import EndpointsEndpoints },
options: | {
readonly url?: string
readonly serialization?: Layer.Layer<RpcSerialization.RpcSerialization>
}
| undefined
options?: {
readonly url?: string | undefinedurl?: string;
readonly serialization?: | Layer.Layer<
RpcSerialization.RpcSerialization,
never,
never
>
| undefined
serialization?: import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<import RpcSerializationRpcSerialization.class RpcSerializationclass RpcSerialization {
key: Identifier;
Service: {
makeUnsafe: () => RpcSerialization.Parser;
contentType: string;
includesFraming: boolean;
};
}
Service that describes how RPC protocol messages are encoded and decoded,
including the content type and whether the serialization format provides
message framing.
When to use
Use to provide the serialization boundary shared by RPC clients and servers
for a chosen wire format.
RpcSerialization>;
},
): import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<function (type parameter) Self in <Self>(node: NodeKey<Self> & {
readonly url?: string;
readonly endpoints?: Endpoints;
}, options?: {
readonly url?: string;
readonly serialization?: Layer.Layer<RpcSerialization.RpcSerialization>;
}): Layer.Layer<Self>
Self> =>
// The client sibling of {@link Node.http} = `connect` + {@link protocolHttp}. Prefers the node's own
// Http endpoint (multi-protocol), then its primary `url`, then `"/rpc"` (same-origin) — `options.url`
// overrides. The browser guard lives in `protocolHttp` (the root), so it applies here too.
import connectLayerconnectLayer(
node: anynode,
const protocolHttp: (
target?: number | string,
serialization?: Layer.Layer<RpcSerialization.RpcSerialization>
) => Layer.Layer<RpcClient.Protocol>
Build an http client Protocol (Fetch + ndjson serialization) for an endpoint — the value you
hand
layerProtocol
or
connect
. target is a port (3009 → http://${clientHost}:3009/rpc,
Config host default "localhost"), a full url, or a same-origin path (default "/rpc"). The
server/CLI transport; a browser should prefer
protocolWebsocket
(HTTP/1.1's ~6-connection cap
starves streams — protocolHttp dies loudly in a browser).
protocolHttp(
options: | {
readonly url?: string
readonly serialization?: Layer.Layer<RpcSerialization.RpcSerialization>
}
| undefined
options?.url?: string | undefinedurl ?? node: anynode.endpoints?.Http?.url ?? node: anynode.url ?? "/rpc",
options: | {
readonly url?: string
readonly serialization?: Layer.Layer<RpcSerialization.RpcSerialization>
}
| undefined
options?.serialization?: | Layer.Layer<
RpcSerialization.RpcSerialization,
never,
never
>
| undefined
serialization,
),
);