Hyperlinkv0.8.0-beta.28

Hyperlink

Hyperlink.nodeKindsOfconstsrc/Hyperlink.ts:2566
(tag: unknown): ReadonlyArray<ProtocolKind>

The full set of ProtocolKinds a tag's Node speaks — every transport in its endpoints set (a multi-protocol node has several), or its single primary kind, or [] for a nodeless/bare tag. A structural read; the server asserts its own transport is a member of this set (ProtocolKindMismatch) so a node served over any of its declared transports passes.

ProtocolKindNodeProtocolKindMismatch
Source src/Hyperlink.ts:256618 lines
export const nodeKindsOf = (tag: unknown): ReadonlyArray<ProtocolKind> => {
  const node = nodeOf(tag);
  if (node === undefined) {
    return [];
  }
  const kinds: Array<ProtocolKind> = [];
  if (Predicate.hasProperty(node, "endpoints")) {
    const ep = node.endpoints;
    if (Predicate.hasProperty(ep, "Http")) kinds.push("Http");
    if (Predicate.hasProperty(ep, "WebSocket")) kinds.push("WebSocket");
    if (Predicate.hasProperty(ep, "IpcSocket")) kinds.push("IpcSocket");
  }
  if (kinds.length > 0) {
    return kinds;
  }
  const single = nodeKindOf(tag);
  return single !== undefined ? [single] : [];
};
Referenced by 1 symbols