Hyperlinkv0.8.0-beta.28

Node

export const connectIpc: {
  (path: string): <Self>(node: NodeKey<Self>) => Layer.Layer<Self>;
  <Self>(
    node: NodeKey<Self> & { readonly path?: string; readonly endpoints?: Endpoints },
  ): Layer.Layer<Self, UnaddressedNode>;
} = Fn.dual(
  (args: IArguments) => typeof args[0] !== "string",
  (
    node: NodeKey<unknown> & { readonly path?: string; readonly endpoints?: Endpoints },
    path?: string,
    // Prefer the node's OWN IpcSocket endpoint over the primary `path` (multi-protocol parity).
  ): Layer.Layer<unknown, UnaddressedNode> => {
    const sock = path ?? node.endpoints?.IpcSocket?.path ?? node.path;
    if (sock === undefined) {
      return unaddressedLayer(node.key);
    }
    return connectLayer(node, Hyperlink.protocolIpc(sock));
  },
);
Referenced by 1 symbols