ComfyUI : WebSockets API : Part 1

Monitor & Manipulate Executing Workflows

Yushan777
10 min readDec 27, 2023

Note: I have decided to make some my articles members-only 2 weeks after publication. I put a lot of time into some of these so my apologies if you come to this a bit late.

The past few API guides covered the basic API mechanisms. However as you may have noticed, once you run your script, it just throws everything into the queue, your script finishes and you are left wondering with no feedback (unless you are looking at ComfyUI’s server output).

This may be fine for some, they just want to run a list of prompts, against a list of checkpoints say for an XY plot, and come back in a couple of hours.

If however you plan on making a ComfyUI-based backend, with a custom frontend then you will probably want some feedback during jobs, maybe the ability to view and save images, upload image for img2img workflows, check on real-time progress etc.

We will download and reuse the script from the ComfyUI : Using The API : Part 1 guide as a starting point and modify it to include the WebSockets code from the websockets_api_example script from the ComfyUI Repo.

There will be a few code snippets but hopefully they are easy to follow. Simply put, we will introduce several new functions from the…

--

--

Yushan777

No Click-Baity stuff! This is just my own journal so I can remember how I did stuff 🙂