"git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "a55305655e28efa768f35c460c971f40e300c8d1"
Commit 223177e1 authored by comfyanonymous's avatar comfyanonymous
Browse files

Merge branch 'custom-node-socket' of https://github.com/pythongosssss/ComfyUI

parents 8a35c12e a49b5659
...@@ -29,6 +29,8 @@ async def cache_control(request: web.Request, handler): ...@@ -29,6 +29,8 @@ async def cache_control(request: web.Request, handler):
class PromptServer(): class PromptServer():
def __init__(self, loop): def __init__(self, loop):
PromptServer.instance = self
mimetypes.init(); mimetypes.init();
mimetypes.types_map['.js'] = 'application/javascript; charset=utf-8' mimetypes.types_map['.js'] = 'application/javascript; charset=utf-8'
self.prompt_queue = None self.prompt_queue = None
......
class ComfyApi extends EventTarget { class ComfyApi extends EventTarget {
#registered = new Set();
constructor() { constructor() {
super(); super();
} }
addEventListener(type, callback, options) {
super.addEventListener(type, callback, options);
this.#registered.add(type);
}
/** /**
* Poll status for colab and other things that don't support websockets. * Poll status for colab and other things that don't support websockets.
*/ */
...@@ -82,7 +89,11 @@ class ComfyApi extends EventTarget { ...@@ -82,7 +89,11 @@ class ComfyApi extends EventTarget {
this.dispatchEvent(new CustomEvent("executed", { detail: msg.data })); this.dispatchEvent(new CustomEvent("executed", { detail: msg.data }));
break; break;
default: default:
throw new Error("Unknown message type"); if (this.#registered.has(msg.type)) {
this.dispatchEvent(new CustomEvent(msg.type, { detail: msg.data }));
} else {
throw new Error("Unknown message type");
}
} }
} catch (error) { } catch (error) {
console.warn("Unhandled message:", event.data); console.warn("Unhandled message:", event.data);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment