Overview
The Comfy server runs on top of the aiohttp framework, which in turn uses asyncio. Messages from the server to the client are sent by socket messages through thesend_sync
method of the server,
which is an instance of PromptServer
(defined in server.py
). They are processed
by a socket event listener registered in api.js
. See messages.
Messages from the client to the server are sent by the api.fetchApi()
method defined in api.js
,
and are handled by http routes defined by the server. See routes.
The client submits the whole workflow (widget values and all) when you queue a request.
The server does not receive any changes you make after you send a request to the queue.
If you want to modify server behavior during execution, you’ll need routes.