ComfyUI native API integration with ComfyStream #180
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One of the primary limitations of building workflows within ComfyStream is the use of the hiddenswitch fork.
Many difficulties arise when particular node packs do not play well with the EmbeddedComfyClient. Careful testing and modifications to existing nodes is usually required to enable full functionality. Nonetheless, there are usually other issues that may come from dependency on the fork, such as delays or limitations with newer ComfyUI features, including native performance optimizations.
I set out to replace the EmbeddedComfyClient with communication directly to a running ComfyUI instance through a native API and Websocket connection.
Sending Data: All data can be sent via REST
POST /promptthrough the Comfy API. Currently, the method to pass incoming frames is done via the comfyui-tooling-nodes, withETN_LoadImageBase64, where the input frame is passed as base64 data in the prompt request itself. This node will be migrated to the ComfyStream/nodespack.Receiving Data: Message events from the webhook are parsed, and data can be received and added to the
image_outputstensor array for WebRTC frames. The comfyui-tooling-nodes includesETN_SendImageWebSocketwhich includes a Blob format with prefix similar to how Comfy sends previews to the UI. Upon successfully capturing the Blob, the prompt can then be called for the next subsequent frame.It is obvious that this process is not as efficient as the hiddenswitch method of communicating with the ComfyStream
tensor_cachedirectly, however it opens up new opportunities for parallelization through multi-inference gpu scaling as well as multi-gpu scaling, an avenue I'm investigating as a performance increase./nodespack, and add auto-replacement