Nodes/SP-Nodes/SP_SendStringWebsocket
ComfyUI Node

SP_SendStringWebsocket

Push text out to whatever's listening on your API connection

By bananasss00·Created 2 years ago·Updated 12 days ago· 20
SP_SendStringWebsocket
      string

      This one only makes sense once you know who it's for: not the person clicking "Queue Prompt" in the browser, but whatever external app is talking to ComfyUI over its API. If you're running workflows purely through the ComfyUI UI by hand, you'll probably never touch SP_SendStringWebsocket - but if you're building or using a tool that drives ComfyUI programmatically, this is a small, sharp piece of plumbing worth knowing about.

      What it does

      One required input: string, a text field defaulting to empty. No outputs - it's an output node, meaning it's a terminal action rather than something you chain further. The node's own description is unusually precise about what it sends: a JSON message over ComfyUI's websocket connection, containing node_id and string. That node_id matters - it's how a client watching the websocket knows which node in the graph sent the message, so if your workflow has several of these scattered around, the receiving app can tell them apart.

      Why this exists

      The author of SP-Nodes also builds Comfizen, a separate Windows desktop app that turns a ComfyUI API workflow into a simplified point-and-click interface - drag in your workflow JSON, expose just the parameters you care about, skip the node graph entirely for day-to-day use. Tools like that need a channel back out of the workflow: a way for something happening mid-generation - a computed caption, a status string, a value some other node worked out - to reach the client UI while the run is still in progress, not just at the end. SP_SendStringWebsocket is that channel. It rides ComfyUI's own websocket connection, the same one that already streams progress and preview images to the browser and to API clients, and just adds your own custom text payload onto it.

      How you'd use it

      Drop it wherever in your graph you've computed something worth surfacing - a resolved prompt after some text processing, a status flag from a conditional branch, a value you want to confirm arrived correctly. Wire a STRING into it, and any client connected to that run's websocket (the ComfyUI frontend itself, or your own API client) can pick the message out by matching on node_id. If you're not writing your own client and just running workflows through the standard ComfyUI UI, there's nothing to see here - the browser doesn't have a built-in listener for arbitrary custom messages like this one.

      Installing it

      Part of the SP-Nodes pack:

      • ComfyUI Manager: search "SP-Nodes", install, restart.
      • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/bananasss00/ComfyUI-SP-Nodes, restart ComfyUI.

      No models, no heavy dependencies - it's a thin wrapper around ComfyUI's existing websocket machinery.

      Troubleshooting

      If nothing seems to arrive on your client, remember this rides the run's websocket connection - you need to be subscribed to the right client/session ID, the same one your API call used to queue the prompt, or the message goes nowhere you're listening. And because ComfyUI's API is unauthenticated by default, if you've exposed your instance beyond localhost, anything travelling over this channel is visible to anyone who can reach the port - worth keeping in mind before you route anything sensitive through it.

      CategorySP-Nodes/websocket

      Inputs (1)

      NameTypeDefaultDescription
      stringSTRING

      Outputs (0)

      No outputs