Invoke (websocket) doesn't support multiple returns
When using the web-socket client, the first node that returns an output (message type = executed) terminates the connection:
https://github.com/StableCanvas/comfyui-client/blob/32aba55d5dd6890b5f1650484b084c2928fd9768/src/InvokedWorkflow.ts#L144-L152
But looking at the Comfy UI message types, there wasn't an obvious message to listen for show that all nodes have completed other than perhaps watching the queue count on the status message.
The immediate workaround is to just use the invoke_polling method, which works fine for my purposes. But thought I'd get your thoughts before trying to fix it in my fork.
thx feedback.
I just tested it and found that the main-wf-loop.ts example code triggers this issue (if using ETN_SendImageWebSocket). It seems I had probably encountered this before but didn't pinpoint the cause at the time 😂
If we want to fix this, I estimate it should be quite simple. We can check the task status each time we detect an "executed" state from a task, instead of immediately considering the workflow as completed.
You're right, there's no direct interface to query the task status. So I've wrapped a function on the client class to do this: client.getPromptStatus(prompt_id).
Would you like to submit a PR? If you've attempted a fix, feel free to share your results.
Fixed https://github.com/StableCanvas/comfyui-client/commit/8a7dc42a58c2d446d400d713c1228290799dec87
I discovered another issue, so I fixed it together. You can try it out, and if there are still problems, we can continue discussing.