@@ -14,27 +14,58 @@ The prompt queue is defined in `execution.py`, which also defines the `PromptExe
1414
1515` server.py ` defines the following routes:
1616
17- | path | get/post | purpose |
18- | ------------------------------ | -------- | ------------------------------------------------------------------------- |
19- | ` / ` | get | load the comfy webpage |
20- | ` /embeddings ` | get | retrieve a list of the names of embeddings available |
21- | ` /extensions ` | get | retrieve a list of the extensions registering a ` WEB_DIRECTORY ` |
22- | ` /workflow_templates ` | get | retrieve a map of custom node modules and associated template workflows |
23- | ` /upload/image ` | post | upload an image |
24- | ` /upload/mask ` | post | upload a mask |
25- | ` /view ` | get | view an image. Lots of options, see ` @routes.get("/view") ` in ` server.py ` |
26- | ` /view_metadata ` /{ folder_name } | get | retrieve metadata for a model |
27- | ` /system_stats ` | get | retrieve information about the system (python version, devices, vram etc) |
28- | ` /prompt ` | get | retrieve current status |
29- | ` /prompt ` | post | submit a prompt to the queue |
30- | ` /object_info ` | get | retrieve details of all node types |
31- | ` /object_info/{node_class} ` | get | retrieve details of one node type |
32- | ` /history ` | get | retrieve the queue history |
33- | ` /history/{prompt_id} ` | get | retrieve the queue history for a specific prompt |
34- | ` /history ` | post | clear history or delete history item |
35- | ` /queue ` | get | retrieve the state of the queue |
36- | ` /interrupt ` | post | stop the current workflow |
37- | ` /free ` | post | free memory by unloading specified models |
17+ #### Core API Routes
18+
19+ | path | get/post/ws | purpose |
20+ | ------------------------------ | ----------- | ------------------------------------------------------------------------- |
21+ | ` / ` | get | load the comfy webpage |
22+ | ` /ws ` | websocket | WebSocket endpoint for real-time communication with the server |
23+ | ` /embeddings ` | get | retrieve a list of the names of embeddings available |
24+ | ` /extensions ` | get | retrieve a list of the extensions registering a ` WEB_DIRECTORY ` |
25+ | ` /features ` | get | retrieve server features and capabilities |
26+ | ` /models ` | get | retrieve a list of available model types |
27+ | ` /models/{folder} ` | get | retrieve models in a specific folder |
28+ | ` /workflow_templates ` | get | retrieve a map of custom node modules and associated template workflows |
29+ | ` /upload/image ` | post | upload an image |
30+ | ` /upload/mask ` | post | upload a mask |
31+ | ` /view ` | get | view an image. Lots of options, see ` @routes.get("/view") ` in ` server.py ` |
32+ | ` /view_metadata ` /{ folder_name } | get | retrieve metadata for a model |
33+ | ` /system_stats ` | get | retrieve information about the system (python version, devices, vram etc) |
34+ | ` /prompt ` | get | retrieve current queue status and execution information |
35+ | ` /prompt ` | post | submit a prompt to the queue |
36+ | ` /object_info ` | get | retrieve details of all node types |
37+ | ` /object_info/{node_class} ` | get | retrieve details of one node type |
38+ | ` /history ` | get | retrieve the queue history |
39+ | ` /history/{prompt_id} ` | get | retrieve the queue history for a specific prompt |
40+ | ` /history ` | post | clear history or delete history item |
41+ | ` /queue ` | get | retrieve the current state of the execution queue |
42+ | ` /queue ` | post | manage queue operations (clear pending/running) |
43+ | ` /interrupt ` | post | stop the current workflow execution |
44+ | ` /free ` | post | free memory by unloading specified models |
45+ | ` /userdata ` | get | list user data files in a specified directory |
46+ | ` /v2/userdata ` | get | enhanced version that lists files and directories in structured format |
47+ | ` /userdata/{file} ` | get | retrieve a specific user data file |
48+ | ` /userdata/{file} ` | post | upload or update a user data file |
49+ | ` /userdata/{file} ` | delete | delete a specific user data file |
50+ | ` /userdata/{file}/move/{dest} ` | post | move or rename a user data file |
51+ | ` /users ` | get | get user information |
52+ | ` /users ` | post | create a new user (multi-user mode only) |
53+
54+ ### WebSocket Communication
55+
56+ The ` /ws ` endpoint provides real-time bidirectional communication between the client and server. This is used for:
57+ - Receiving execution progress updates
58+ - Getting node execution status in real-time
59+ - Receiving error messages and debugging information
60+ - Live updates when queue status changes
61+
62+ The WebSocket connection sends JSON messages with different types such as:
63+ - ` status ` - Overall system status updates
64+ - ` execution_start ` - When a prompt execution begins
65+ - ` execution_cached ` - When cached results are used
66+ - ` executing ` - Updates during node execution
67+ - ` progress ` - Progress updates for long-running operations
68+ - ` executed ` - When a node completes execution
3869
3970### Custom routes
4071
0 commit comments