Hyperlinkv0.8.0-beta.28

Node

Node.connectHttpconstsrc/internal/node.ts:259
(url: string): <Self>(node: NodeKey<Self>) => Layer.Layer<Self>
<Self>(
  node: NodeKey<Self> & {
    readonly url?: string
    readonly endpoints?: Endpoints
  }
): Layer.Layer<Self>

Wire a node over http — Effect's layerProtocolHttp transport, connect pinned to kind: "Http". Dual: MyNode.pipe(Hyperlink.connectHttp) uses the node's own url (or "/rpc"); MyNode.pipe(Hyperlink.connectHttp(url)) overrides it.

connectconnect
export const connectHttp: {
  // data-last first, node form last — so the bare pipe (`node.pipe(connectHttp)`) resolves to the node
  // overload (TS picks the last for a bare value); `connectHttp(url)` still matches the string overload.
  (url: string): <Self>(node: NodeKey<Self>) => Layer.Layer<Self>;
  <Self>(
    node: NodeKey<Self> & { readonly url?: string; readonly endpoints?: Endpoints },
  ): Layer.Layer<Self>;
} = Fn.dual(
  (args: IArguments) => typeof args[0] !== "string",
  (
    node: NodeKey<unknown> & { readonly url?: string; readonly endpoints?: Endpoints },
    url?: string,
    // Prefer the node's OWN Http endpoint over the primary `url` — a multi-protocol `{ http, ws }` node
    // has a WebSocket primary-or-http primary but its Http endpoint is the right target for `connectHttp`.
  ): Layer.Layer<unknown> =>
    connectLayer(node, Hyperlink.protocolHttp(url ?? node.endpoints?.Http?.url ?? node.url ?? "/rpc")),
);