Nodes/MKRShift_Nodes/TCP Bridge Plan
ComfyUI Node

TCP Bridge Plan

Describe the connection, don't dial it

By criskb·Created 7 months ago·Updated 5 months ago· 0
TCP Bridge Plan
    • tcp_plan_json
    • manifest_line
    • summary_json
    host127.0.0.1
    port7001
    framingjson_line
    payload_json{}

    This is the config half of a two-node TCP bridge, and it's the one that does the paperwork. MKRTCPBridgePlan turns four fields into a tcp_plan_json document describing where to connect and how to frame the messages. It doesn't open a socket, doesn't send a byte - its sibling MKRTCPBridgeSend does that. Think of it as writing down the address before you call.

    That split is deliberate and actually convenient. The plan node gives you one authoritative JSON blob that describes the connection, so you can build the plan once, inspect it, log it, or feed it into multiple senders without retyping host and port all over the graph. It's textbook plumbing in the ComfyUI sense: one source of truth, fan out to many consumers.

    The fields that matter

    • host - defaults to 127.0.0.1, which is loopback. That's the right starting point: it means the app you're talking to is on the same machine. Move it to a LAN IP only when you've confirmed the listener is actually remote.
    • port - default 7001. Match this exactly to whatever the receiving app is listening on, or nothing connects.
    • framing - the one with real consequences: json_line (JSON plus a newline, the default and the sanest for humans), raw_json (bare JSON, no terminator), or length_prefixed (a 4-byte big-endian length header in front). The receiver's parser decides which you need; picking the wrong one is the classic "it connected but nothing arrived" failure.
    • payload_json - the default message body, defaulting to {}.

    Outputs

    tcp_plan_json (the plan), manifest_line (host/port/framing joined for easy handoff), and summary_json. Wire tcp_plan_json straight into MKRTCPBridgeSend's input of the same name and you're done - the send node will also accept a payload_json override if you want to swap the message at send time.

    Installing it

    Part of criskb/MKRShift_Nodes from Cris K B. ComfyUI Manager: search "MKRShift_Nodes". Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/criskb/MKRShift_Nodes
    

    Restart ComfyUI. No pip dependencies and no models - this node is string handling end to end, so install cost is zero beyond the pack itself.

    Where people get burned

    Mostly the framing mismatch and the port typo. A TCP listener that expects length-prefixed frames will happily accept your newline-terminated JSON, read garbage as a length, and then sit there looking like a failed connection. Check the receiver's protocol first, then set framing to match. And remember the plan alone does nothing - if you run the graph and the summary says everything's fine but no packet moved, you forgot to also run MKRTCPBridgeSend.

    CategoryMKRShift Nodes/Addons/Network

    Inputs (4)

    NameTypeDefaultDescription
    hostSTRING127.0.0.1
    portINT70011–65535
    framingCOMBOjson_line3 options: json_line, raw_json, length_prefixed
    payload_jsonSTRING{}

    Outputs (3)

    NameTypeDescription
    tcp_plan_jsonSTRING
    manifest_lineSTRING
    summary_jsonSTRING