GeezerVison is showing github.com — does async callback supported? · Issue #41 · webui-dev/python-webui
does async callback supported? #41
Activity
AlbertShown commented on Sep 26, 2025
WebUI supports it, it's implemented by default in some wrappers like Deno-WebUI because everything is async, but in Python-WebUI I think it should be done manually.
To make your WebUI project support async try this:
1 - initialize WebUI with async enabled
# in your main start, initialize WebUI with async enabled
# Config.asynchronous_response = number 5
# More info:
# https://github.com/webui-dev/python-webui/blob/c4b55892baa9367dd7cd4005ab30542e81f954b4/PyPI/Package/src/webui/webui.py#L116
set_config(Config.asynchronous_response, True)
# Now, WebUI events will bypass the callback instant return, and wait forever for the async response trough any `e.return_xxx()`
2 - Set your event async response
# In your events call, make sure to call any `e.return_xxx()` to set your async response to the UI
def myCallbackExample(e : webui.Event):
# do your async operations...
# Python may return right away a void response to C (WebUI), but WebUI will ignore it and wait for any `e.return_xxx()`
e.return_int(123) # Now WebUI will pass the response to UI.congzhangzh commented on Sep 26, 2025
congzhangzh commented on Sep 26, 2025
AlbertShown commented on Sep 29, 2025
Metadata
Metadata
Development
No branches or pull requestsIssue actions