Nodes/ComfyUI Deploy/Image Websocket Output (ComfyDeploy)
ComfyUI Node

Image Websocket Output (ComfyDeploy)

Stream images to a web client mid-generation — no waiting for the full run

By BennyKok·Created 3 years ago·Updated 10 months ago· 1,529
Image Websocket Output (ComfyDeploy)
  • images
    â—„output_idoutput_idâ–º
    ◄file_type▾►
    â—„quality80â–º
    â—„client_idâ–º

    This is the node behind the demo that made Comfy Deploy famous in early 2024: BennyKok's "Realtime ComfyUI streaming i/o" post, where an SDXL workflow re-rendered live as you painted on a canvas. "Image Websocket Output" pushes each image over the websocket as it's produced, so a web app can show the result - or a live intermediate - the moment it exists, instead of after the whole prompt queue drains.

    For plain batch generation you don't need this; the regular Image Output node uploads results after the run. Websocket output is for realtime and interactive stuff: LCM/SD-Turbo live painting, preview streaming into a Next.js app, anything where a human is waiting and watching.

    How it works

    The node is a terminal output, but instead of writing a file it calls into ComfyUI's event loop and sends a binary websocket message (the same PREVIEW_IMAGE event type ComfyUI itself uses for previews) containing the encoded image, tagged with your output_id. If you set client_id, the image goes only to that client's socket; leave it empty and it broadcasts to every connected websocket.

    The mechanism is genuinely low-latency - that's why it's the realtime workhorse of the pack. But there's a catch baked into the protocol: output_id must be ASCII and max 24 bytes. The node validates this on load and throws a clear error if you exceed it, so keep your ids short and boring (preview is fine; output_for_the_very_excited_client is not).

    The inputs

    • output_id - the key the client uses to match the incoming stream.
    • images - the IMAGE tensor to send.
    • file_type - WEBP, PNG, or JPEG (uppercase here, unlike the file-saving nodes).
    • quality - 1–100, default 80. WebP at 80 is the sane realtime default; smaller payloads, faster frames.
    • client_id - optional; empty means broadcast.

    No outputs, obviously - it's a terminal node whose "output" travels over the wire.

    Installing it

    Standard ComfyUI Deploy install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/BennyKok/comfyui-deploy.git
    

    Restart ComfyUI, or search "ComfyUI Deploy" in ComfyUI Manager. No extra models, no key for local use. First-load pip install pulls opencv-python (chunky), aiofiles, pydantic, brotli, imageio-ffmpeg, and tabulate.

    Where people get burned

    The most common misread is thinking the image shows up in the ComfyUI UI or the dashboard like a normal save. It doesn't - it goes to websocket clients only. If nothing's listening on the socket, the frames vanish and the node still "succeeds." That's by design; test it with the Next.js starter kit (BennyKok/comfyui-deploy-next-example) so you have a client that speaks the binary protocol.

    Second gotcha: unlike a saved file, there's no record of the streamed image anywhere on disk. If your use case needs a permanent artifact (thumbnails, history, gallery), pair this node with the regular Image Output so you get both the live stream and the saved file.

    Category🔗ComfyDeploy

    Inputs (5)

    NameTypeDefaultDescription
    output_idSTRINGoutput_id—
    imagesIMAGE—
    file_typeCOMBO3 options: WEBP, PNG, JPEG
    qualityINT801–100—
    client_idoptSTRING—

    Outputs (0)

    No outputs