diff --git a/invokeai/app/api/sockets.py b/invokeai/app/api/sockets.py index 20fa6606bd5..ae699f35efc 100644 --- a/invokeai/app/api/sockets.py +++ b/invokeai/app/api/sockets.py @@ -3,16 +3,19 @@ from fastapi import FastAPI from fastapi_events.handlers.local import local_handler from fastapi_events.typing import Event -from fastapi_socketio import SocketManager +from socketio import ASGIApp, AsyncServer from ..services.events import EventServiceBase class SocketIO: - __sio: SocketManager + __sio: AsyncServer + __app: ASGIApp def __init__(self, app: FastAPI): - self.__sio = SocketManager(app=app) + self.__sio = AsyncServer(async_mode="asgi", cors_allowed_origins="*") + self.__app = ASGIApp(socketio_server=self.__sio, socketio_path="socket.io") + app.mount("/ws", self.__app) self.__sio.on("subscribe_queue", handler=self._handle_sub_queue) self.__sio.on("unsubscribe_queue", handler=self._handle_unsub_queue) diff --git a/pyproject.toml b/pyproject.toml index 60041aa836b..b9410999ec1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,6 @@ dependencies = [ "facexlib", "fastapi==0.88.0", "fastapi-events==0.8.0", - "fastapi-socketio==0.0.10", "huggingface-hub~=0.16.4", "invisible-watermark~=0.2.0", # needed to install SDXL base and refiner using their repo_ids "matplotlib", # needed for plotting of Penner easing functions